get_object_vars
Gets the properties of the given object
&reftitle.description;
arrayget_object_vars
objectobject
Gets the properties of the given object.
&reftitle.parameters;
object
An object instance.
&reftitle.returnvalues;
Returns an associative array of defined object properties for the
specified object. If a property have not been
assigned a value, it will be returned with a &null; value.
&reftitle.changelog;
&Version;
&Description;
prior to 4.2.0
If the variables declared in the class of which the
object is an instance, have not been assigned a
value, those will not be returned in the array
&reftitle.examples;
Use of get_object_vars
x = $x;
$this->y = $y;
}
function setLabel($label)
{
$this->label = $label;
}
function getPoint()
{
return array("x" => $this->x,
"y" => $this->y,
"label" => $this->label);
}
}
// "$label" is declared but not defined
$p1 = new Point2D(1.233, 3.445);
print_r(get_object_vars($p1));
$p1->setLabel("point #1");
print_r(get_object_vars($p1));
?>
]]>
&example.outputs;
1.233
[y] => 3.445
[label] =>
)
Array
(
[x] => 1.233
[y] => 3.445
[label] => point #1
)
]]>
&reftitle.seealso;
get_class_methods
get_class_vars