note 38624 added to function.get-object-vars
| From: | christopherATNOSPAMATidealabDOTcom at rn2 dot php dot net | Date: | Tue, 30 Dec 2003 20:12:00 +0000 |
| Subject: | note 38624 added to function.get-object-vars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62693@lists.php.net to get a copy of this message | ||
Hmmm. A bit embarassing...
It turns out the best way to get references to all of your objects member variables is NOT with the
functions I provided before, or with get_object_vars.
Just cast the object to array.
$a=(array)$obj;
# The two following statements are now equivalent and identical
$a["member"]=3;
$obj->member=3;
A very powerful tool, for inspectors and what not.
----
Manual Page -- http://www.php.net/manual/en/function.get-object-vars.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38624
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38624&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38624&report=yes
Search -- http://master.php.net/manage/user-notes.php