Does anyone know for php AbstractEnumeration if there is any way to do another level underneath it?
so like...
const a = 'a';
const b = 'b';
But I have an optional parameter for a:
const a = 'a' => '=123'
I know this is probably going to end up as a hash table instead, but just wondering what interesting things I can do with php enums.
PHP doesn't support native Enumerations.
You do something like:
abstract class ErrorCode
{
const NOT_FOUND = 404;
const OK = 200;
// etc.
}
$error = ErrorCode::NOT_FOUND;
This won't work in PHP:
const a = 'a' => '=123'
you could serialize the object as an array:
# serialize data into an array
define ("a", serialize (array ("a" => 123)));
# use it wherever you want
$a = unserialize (a);