rossriley / php-scalar-objects

Experimental API for PHP Scalar Objects
70 stars 6 forks source link

Array should implement ArrayAccess #10

Closed mnapoli closed 10 years ago

mnapoli commented 10 years ago

http://fr2.php.net/manual/en/class.arrayaccess.php

rossriley commented 10 years ago

Is there any value to doing this, the scalars already by definition support it since they are arrays.

Do we gain anything by being able to call the method? eg: $array = [1,2,3,4,5,6]; $array->offsetGet(0); // 1

As opposed to just using $array[0];

mnapoli commented 10 years ago

You are right, I thought about this without taking into account that it's to be merge in php's core (not a userland library) :)