array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'reflectionclass.getstaticpropertyvalue.php', 1 => 'ReflectionClass::getStaticPropertyValue', ), 'up' => array ( 0 => 'class.reflectionclass.php', 1 => 'ReflectionClass', ), 'prev' => array ( 0 => 'reflectionclass.getstaticproperties.php', 1 => 'ReflectionClass::getStaticProperties', ), 'next' => array ( 0 => 'reflectionclass.gettraitaliases.php', 1 => 'ReflectionClass::getTraitAliases', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionclass/getstaticpropertyvalue.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
ReflectionClass::getStaticPropertyValue — Gets static property value
Gets the value of a static property on this class.
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.
The value of the static property.
Exemplo #1 Basic usage of ReflectionClass::getStaticPropertyValue()
<?php
class Apple {
public static $color = 'Red';
}
$class = new ReflectionClass('Apple');
var_dump($class->getStaticPropertyValue('color'));
?>
O exemplo acima produzirá:
string(3) "Red"