note 55406 added to function.get-object-vars
| From: | stachnikatgmaildotcom at osu1 dot php dot net | Date: | Tue, 02 Aug 2005 16:00:44 +0000 |
| Subject: | note 55406 added to function.get-object-vars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92959@lists.php.net to get a copy of this message | ||
In PHP5 to get an array with all properties (even the private ones) all you have to do is write a
public method that returns an array for your class:
public function getArray()
{
return get_object_vars($this);
}
and then
$myBeautifulArray = $myBeautifulObject->getArray ();
Have BEAUTIFUL day :)
----
Manual Page -- http://www.php.net/manual/en/function.get-object-vars.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55406
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55406&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55406&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55406&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55406&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55406&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55406&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55406&report=yes
Search -- http://master.php.net/manage/user-notes.php