get_class_vars
Get the default properties of the class
&reftitle.description;
arrayget_class_vars
stringclass_name
Get the default properties of the given class.
&reftitle.parameters;
class_name
The class name
&reftitle.returnvalues;
Returns an associative array of declared properties visible from the
current scope, with their default value.
The resulting array elements are in the form of
varname => value.
In case of an error, it returns &false;.
&reftitle.changelog;
&Version;
&Description;
5.0.3
get_class_vars will
only return the properties that can be accessed from the current
scope.
5.0.2
Calling get_class_vars will now expose
all the properties as an array, unlike previous behaviour where
protected and private properties were prefixed with nul bytes.
5.0.1
Calling get_class_vars will expose all
properties, as when converting an object to a class.
&reftitle.examples;
get_class_vars example
var1 = "foo";
$this->var2 = "bar";
return true;
}
}
$my_class = new myclass();
$class_vars = get_class_vars(get_class($my_class));
foreach ($class_vars as $name => $value) {
echo "$name : $value\n";
}
?>
]]>
&example.outputs;
get_class_vars and scoping behaviour
]]>
&example.outputs;
&reftitle.seealso;
get_class_methods
get_object_vars