get_object_vars

array get_object_vars(object obj) 

Gets an object’s member variables, along with the variables’ current values.

Returns:

Associative array; FALSE if obj is not an object

Description:

get_object_vars() finds the names of the member variables for a given object and returns them as an associative array containing the name of an object’s member variables as array keys and the values of the member variables as array values.

Availability:

UNIX, Windows

Version:

4.0RC1+

See also:

get_class_vars() 
method_exists() 

Example:

Get the names and values of the member variables for an object
 class location { var $x_axis = 0; var $y_axis = 0; var $z_axis = 0; function location ($x, $y, $z) { $this->x_axis = $x; $this->y_axis = $y; $this->z_axis ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.