note 102883 deleted from language.oop5.properties by danbrown
| From: | danbrown@php.net | Date: | Sat, 12 Mar 2011 14:11:22 +0000 |
| Subject: | note 102883 deleted from language.oop5.properties by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177821@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
To add to my comment "Anonymous 11-Mar-2011 11:18" about casting $this to array, this is
documented behavior when converting any object to an array (see
</language.types.array.php#language.types.array.casting> PHP manual page). All properties
regardless of visibility will be shown when casting an object to array (with exceptions of a few
built-in objects).
To get an array with all property names unaltered, use the 'get_object_vars($this)'
function in any method within class scope to retrieve an array of all properties regardless of
external visibility, or 'get_object_vars($object)' outside class scope to retrieve an
array of only public properties (see: </function.get-object-vars.php> PHP manual page).