(PHP 5, PHP 7)
ReflectionClass::getDefaultProperties — ��ȡĬ������
��ȡ���Ĭ�����ԣ������˼̳е����ԣ���
Note:
This method only works for static properties when used on internal classes. The default value of a static class property can not be tracked when using this method on user defined classes.
�˺���û�в�����
Ĭ�����Ե���������������Ե����ƣ���ֵ�����Ե�Ĭ��ֵ����������û��Ĭ��ֵʱ�� NULL��
������������־�̬�ͷǾ�̬���ԣ�Ҳ�����ǿɼ������η���
Example #1 ReflectionClass::getDefaultProperties() ����
<?php
class Bar {
protected $inheritedProperty = 'inheritedDefault';
}
class Foo extends Bar {
public $property = 'propertyDefault';
private $privateProperty = 'privatePropertyDefault';
public static $staticProperty = 'staticProperty';
public $defaultlessProperty;
}
$reflectionClass = new ReflectionClass('Foo');
var_dump($reflectionClass->getDefaultProperties());
?>
�������̻������
array(5) {
["staticProperty"]=>
string(14) "staticProperty"
["property"]=>
string(15) "propertyDefault"
["privateProperty"]=>
string(22) "privatePropertyDefault"
["defaultlessProperty"]=>
NULL
["inheritedProperty"]=>
string(16) "inheritedDefault"
}