Re: Object to array conversion oddity
| From: | Marcus Bointon | Date: | Sat, 23 Sep 2006 15:04:34 +0000 |
| Subject: | Re: Object to array conversion oddity | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242149@lists.php.net to get a copy of this message | ||
On 23 Sep 2006, at 15:51, Ray Hauge wrote:
To me it looks like they append the name of the class to any private variables. I would guess that it does this to make sure you know what you're doing and using the private variable like that. I'm just guessing at that point though.Well, I realised that, but it's not very helpful as there's no separator between class name and variable name it's impossible to separate it correctly - if I had happened to have a property called 'myclassfield1', I would not be able to tell if the real property name was 'myclassfield1' or a private property called 'field1'. If it is going to stray from the documented behaviour, It would be far more useful to retain the names that the var_dump on the object uses - 'field1:private'. That's safe as : is not a value char in a variable name, but it's fine as an array index.
Try a test with multiple public and multiple private variables. If the format of the array keys stays the same, then you should have your answer.In my real code I do have multiple fields all exhibiting this behaviour. I'll report it. Marcus -- Marcus Bointon Synchromedia Limited: Creators of http://www.smartmessages.net/ marcus@synchromedia.co.uk | http://www.synchromedia.co.uk/