getConstNameByValue()
getConstNameByValue(string $class, mixed $value) : string|false
Returns class const name by its value.
use donbidon\Core\Friendlification;
class Foo
{
const ONE = 1;
const TWO = 2;
}
var_dump(Friendlification::getConstNameByValue('Foo', 1));
var_dump(Friendlification::getConstNameByValue('Foo', 2));
var_dump(Friendlification::getConstNameByValue('Foo', 3));
will output:
string(3) "ONE"
string(3) "TWO"
bool(false)
Parameters
string | $class | |
mixed | $value |
Throws
- \ReflectionException
Risen from static::getReflection().