getName()
getName(string $value) : string
Get the name of the member that holds given value
This method is type-sensitive - see the example below.
Use case
You have a value that is defined in an enumeration and you would like to know the name of the enumeration member that holds this value.
Example
class Animal extends Dreamscapes\Enumeration
{
const Horse = 0;
const Dog = 1;
}
echo Animal::getName(0); // Prints 'Horse'
echo Animal::getName('0'); // Returns null, method is type-sensitive
Parameters
string | $value | The member's expected value (type-sensitive) |
Returns
string —The name of the member that holds this value or null if not defined