PHP code example of flashlabs / enums
1. Go to this page and download the library: Download flashlabs/enums 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/ */
flashlabs / enums example snippets
use Flashlabs\Enums\EnumValues;
enum StringsEnum: string
{
use EnumValues;
case TIRAMISU = 'Tiramisu';
case MARSHMALLOW = 'Marshmallow';
case OAT_CAKE = 'Oat cake';
}
foreach (StringsEnum::values() as $value) {
echo $value . PHP_EOL;
}
// Output:
// 'Tiramisu'
// 'Marshmallow'
// 'Oat cake'