(PHP 5 >= 5.1.0, PHP 7)
Gets static property value
public mixed ReflectionClass::getStaticPropertyValue ( string $name [, mixed &$def_value ] )
Gets the value of a static property on this class.
Parameters:
name
The name of the static property for which to return a value.
def_value
A default value to return in case the class does not declare a static property with the given name
. If the property does not exist and this argument is omitted, a ReflectionException is thrown.
Returns:
The value of the static property.
Examples:
Basic usage of ReflectionClass::getStaticPropertyValue()
1 2 3 4 5 6 7 8 | <?php class Apple { public static $color = 'Red' ; } $class = new ReflectionClass( 'Apple' ); var_dump( $class ->getStaticPropertyValue( 'color' )); ?> |
The above example will output:
string(3) "Red"
See also:
Please login to continue.