Re: Re: ArrayObject - Posibillity to add key => value pair per default?
| From: | ceo at l-i-e dot com | Date: | Wed, 14 Jan 2009 16:25:37 +0000 |
| Subject: | Re: Re: ArrayObject - Posibillity to add key => value pair per default? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-286323@lists.php.net to get a copy of this message | ||
In olden times, of PHP 3, you could for sure use ->x and [x] interchangeably, as an Object then
was little more than a C struct with a couple functions tacked on, as was an array.
I think PHP 3 Object may actually have been implemented as a PHP array with some additional C
functions on it, come to think of it...
Anyway, I believe this feature has survived to this day, but would not swear to it in court.
I think your code will be more readable if you stick with one style or the other, personally, but I
suppose there may be cases where [x] is equally clear.
Note that $customClass->key = $value; would probably also work, and be more in tune, even if
it's not a declared member variable of the class.