update : 2015.11.03
php.shukuma.com

검색:
 
 
Gets static property value

ReflectionClass::getStaticPropertyValue

(PHP 5 >= 5.1.0)

ReflectionClass::getStaticPropertyValueGets static property value

설명

public mixed ReflectionClass::getStaticPropertyValue ( string $name [, mixed &$def_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.

예제

Example #1 Basic usage of ReflectionClass::getStaticPropertyValue()

<?php
class Apple {
    public static 
$color 'Red';
}

$class = new ReflectionClass('Apple');
var_dump($class->getStaticPropertyValue('color'));
?>

위 예제의 출력:

string(3) "Red"

참고