PHP code example of pamil / enum
1. Go to this page and download the library: Download pamil/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/ */
pamil / enum example snippets
use Pamil\Enum\Enum;
/**
* @method static static active()
* @method static static inactive()
*/
final class SampleEnum extends Enum
{
protected const active = 1;
protected const inactive = 2;
}
var_dump(SampleEnum::active() === SampleEnum::active()); // true
var_dump(new SampleEnum(1) === SampleEnum::active()); // false
var_dump(unserialize(serialize(SampleEnum::active())) === SampleEnum::active());