GoLang ReflectionClass::getDefaultProperties

request it (249)
GoLang replacement for PHP's ReflectionClass::getDefaultProperties [edit | history]

Do you know a GoLang replacement for PHP's ReflectionClass::getDefaultProperties? Write it!

PHP ReflectionClass::getDefaultProperties

PHP original manual for ReflectionClass::getDefaultProperties [ show | php.net ]


(PHP 5, PHP 7)

ReflectionClass::getDefaultPropertiesGets default properties


public array ReflectionClass::getDefaultProperties ( void )

Gets default properties from a class (including inherited properties).


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.


This function has no parameters.

Return Values

An array of default properties, with the key being the name of the property and the value being the default value of the property or NULL if the property doesn't have a default value. The function does not distinguish between static and non static properties and does not take visibility modifiers into account.


Example #1 ReflectionClass::getDefaultProperties() example

class Bar {
$inheritedProperty 'inheritedDefault';

Foo extends Bar {
$property 'propertyDefault';
$privateProperty 'privatePropertyDefault';
    public static 
$staticProperty 'staticProperty';

$reflectionClass = new ReflectionClass('Foo');

The above example will output:

array(5) {
   string(14) "staticProperty"
   string(15) "propertyDefault"
   string(22) "privatePropertyDefault"
   string(16) "inheritedDefault"

See Also