Log in / create account | Login with OpenID
DocForge
Programmer's Wiki

PHP/get object vars

From DocForge

< PHP

get_object_vars returns an associative array containing every non-static property defined in an object, which are visible in the current scope, and their values.

Syntax:

array get_object_vars ( object $object )

When called from within an object, passing it a reference to the current object ($this), all private, protected, and public properties are returned. When called from elsewhere, only the public properties are returned.

Properties which have not been assigned a value will have a null value in the returned array.

[edit] See Also

Do you have information or insights to contribute to this article? Please feel free to edit this page. Ask questions or contribute to the discussion on this article's talk page.