get_object_vars() function returns an array containing the properties of the attributes.
Its syntax is: array get_object_vars (object obj_name)
//Obtaining object variables
<?
class car {
var $doors;
var $wheels;
function car($doors, $wheels) {
$this->doors = $doors;
$this->wheels = $wheels;
}
function get_wheels() {
return $this->wheels;
}
}
$toyota = new car(2,400);
$vars = get_object_vars($toyota);
while (list($key, $value) = each($vars)) :
print "$key ==> $value <br>";
endwhile;
?>
Related examples in the same category