PHP code example of comquer / enum
1. Go to this page and download the library: Download comquer/enum library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
comquer / enum example snippets
use Comquer\Enum\Enum;
class Colors extends Enum
{
public const RED = 'red';
public const GREEN = 'green';
protected const INVISIBLE_COLOR = 'invisible_color';
}
// $red is instance of Enum with value 'red'
$red = Colors::RED();
$red->getValue(); // "red"
$red->getKey();// "RED"