|
constantReturns the value of a constant Description
mixed constant(string
$name )
Return the value of the constant indicated by
constant is useful if you need to retrieve the value of a constant, but do not know its name. I.e. it is stored in a variable or returned by a function. This function works also with class constants and enum cases. Parameters
Return ValuesReturns the value of the constant. Errors/Exceptions
If the constant is not defined, an Error exception is thrown.
Prior to PHP 8.0.0, an Changelog
Examples
Example #1 Using constant with Constants
Example #2 Using constant with Enum Cases (as of PHP 8.1.0)
|