#33015 [Asn->Fbk]: ArrayObject: object- and array-access not interchangeable
| From: | helly@php.net | Date: | Thu, 12 May 2005 21:15:01 +0000 |
| Subject: | #33015 [Asn->Fbk]: ArrayObject: object- and array-access not interchangeable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-78955@lists.php.net to get a copy of this message | ||
ID: 33015
Updated by: helly@php.net
Reported By: pecoes at xs4all dot nl
-Status: Assigned
+Status: Feedback
Bug Type: SPL related
Operating System: *
-PHP Version: 5CVS-2005-05-12
+PHP Version: 5.*
Assigned To: helly
New Comment:
I could equip you with a special factory method or a derived class that
does this. But the way it works it is not possible to achieve what you
want with ArrayObject and its current constructor.
Previous Comments:
------------------------------------------------------------------------
[2005-05-12 12:32:44] pecoes at xs4all dot nl
Description:
------------
It's pretty counter-intuitive, that you can neither access an
ArrayObject's properties with the array-syntax, nor its array-values
with the object-syntax. I think these two should be interchangeable.
Preferably like in ECMAScript...
Reproduce code:
---------------
$a = new ArrayObject();
$a->one = 1;
$a['two'] = 2;
echo "\$a->one: $a->one \$a->two: $a->two \n";
echo "\$a[one]: $a[one] \$a[two]: $a[two] \n";
Expected result:
----------------
$a->one: 1 $a->two: 2
$a[one]: 1 $a[two]: 2
Actual result:
--------------
$a->one: 1 $a->two:
$a[one]: $a[two]: 2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33015&edit=1