ReflectionClass::getProperties
Gets properties
&reftitle.description;
public arrayReflectionClass::getProperties
intnullfilter&null;
Retrieves reflected properties.
&reftitle.parameters;
filter
The optional filter, for filtering desired property types. It's configured using
the ReflectionProperty constants,
and defaults to all property types.
&reftitle.returnvalues;
An array of ReflectionProperty objects.
&reftitle.changelog;
&Version;
&Description;
7.2.0
filter is nullable now.
&reftitle.examples;
ReflectionClass::getProperties filtering example
This example demonstrates usage of the optional filter
parameter, where it essentially skips private properties.
getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
foreach ($props as $prop) {
print $prop->getName() . "\n";
}
var_dump($props);
?>
]]>
&example.outputs.similar;
object(ReflectionProperty)#3 (2) {
["name"]=>
string(3) "foo"
["class"]=>
string(3) "Foo"
}
[1]=>
object(ReflectionProperty)#4 (2) {
["name"]=>
string(3) "bar"
["class"]=>
string(3) "Foo"
}
}
]]>
&reftitle.seealso;
ReflectionClass::getProperty
ReflectionProperty
ReflectionProperty modifier constants