downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ReflectionClass::getDocComment> <ReflectionClass::getConstructor
[edit] Last updated: Fri, 23 Mar 2012

view this page in

ReflectionClass::getDefaultProperties

(PHP 5)

ReflectionClass::getDefaultPropertiesGets default properties

Opis

public array ReflectionClass::getDefaultProperties ( void )

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

Parametry

Ta funkcja nie posiada parametrów.

Zwracane wartości

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.

Przykłady

Przykład #1 ReflectionClass::getDefaultProperties() example

<?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());
?>

Powyższy przykład wyświetli:

array(5) {
   ["staticProperty"]=>
   string(14) "staticProperty"
   ["property"]=>
   string(15) "propertyDefault"
   ["privateProperty"]=>
   string(22) "privatePropertyDefault"
   ["defaultlessProperty"]=>
   NULL
   ["inheritedProperty"]=>
   string(16) "inheritedDefault"
}

Zobacz też:



add a note add a note User Contributed Notes ReflectionClass::getDefaultProperties
runaurufu AT gmail.com 03-Aug-2011 07:02
Worth noting that it will not return private parameters of parent class...
so it works exactly as get_class_vars or get_object_vars
captainjester at hotmail dot com 20-Jan-2010 08:20
This will return all properties in a class and any parent classes.  The array will have keys set to the property names and empty values.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites