1. Go to this page and download the library: Download olegstyle/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/ */
$started = StatusEnum::STARTED(); // will return Enum object by magik command
$error = StatusEnum::instanceFromValue(-1); // will be created object from value
$expired = new StatusEnum(-2); // will be created object from value
$isExpired = $started->isEqual(StatusEnum::EXPIRED()); // will be returned false
$isExpired2 = $expired->isEqual(-2); // will be returned true
$isExpired3 = $started->isEqual('0'); // will be returned false because is using strict mode comparation
$isStartedKey = $started->isEqualKey('STARTED'); // will be returned true
$isStartedKeyEnum = $started->isEqualKey(StatusEnum::STARTED()); // will be returned true
$array = StatusEnum::toArray(); // will be return all constants from StatusEnum class
$pendingKey = StatusEnum::search(1); // will be returned contant name - 'PENDING'
$unknownKey = StatusEnum::search('1'); // will be returned null because is using strict mode
$pendingKey = StatusEnum::getName(1); // similar to search
StatusEnum::isValid(2); // valid key. should be returned true
StatusEnum::isValid('2'); // should be returned false because is using strict mode
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.