class SplEnum extends SplType (View source)

SplEnum gives the ability to emulate and create enumeration objects natively in PHP.

Constants

__default

Methods

__construct(mixed $initial_value = self::__default, bool $strict = true)

Creates a new value of some type

from  SplType
array
getConstList(bool $include_default = false)

Returns all consts (possible values) as an array.

Details

__construct(mixed $initial_value = self::__default, bool $strict = true)

Creates a new value of some type

Parameters

mixed $initial_value
bool $strict

If set to true then will throw UnexpectedValueException if value of other type will be assigned. True by default

array getConstList(bool $include_default = false)

Returns all consts (possible values) as an array.

Parameters

bool $include_default

Whether to include __default constant (property). False by default.

Return Value

array