PHP code example of vladdesv / simple-enum

1. Go to this page and download the library: Download vladdesv/simple-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/ */

    

vladdesv / simple-enum example snippets




use SimpleEnum\Enum;

class MyEnum extends Enum
{
    const foo = 1;
    const bar = 2;
    const baz = 3;
}

$myEnum = new MyEnum(MyEnum::foo);

assert($myEnum->value() === MyEnum::foo);
assert($myEnum->equals(new MyEnum(1)));