ReflectionClass::getStaticPropertyValue
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
ReflectionClass::getStaticPropertyValue — Gets static property value
Beschreibung
Gets the value of a static property on this class.
Parameter-Liste
-
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.
Rückgabewerte
The value of the static property.
Beispiele
Beispiel #1 Basic usage of ReflectionClass::getStaticPropertyValue()
<?php
class Apple {
public static $color = 'Red';
}
$class = new ReflectionClass('Apple');
var_dump($class->getStaticPropertyValue('color'));
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
string(3) "Red"
Siehe auch
- ReflectionClass::getStaticProperties() - Gets static properties
- ReflectionClass::setStaticPropertyValue() - Sets static property value