On Mon, 2010-08-09 at 13:47 +0200, mathieu.suen wrote:
> > outputs ...
> >
> > Array
> > (
> > [1365443950] => First
> > [1235256771] => Second
> > [520059180] => Third
> > [486985268] => Fourth
> > )
>
> Well that is not the expected behavior since if you call array_keys you
> won't get the object.
Well, "arrays" are implemented as hash tables, hash tables work by
generating a hash to identify a value. Changing this is a big change
(rewrite everything accessing array keys) and you can always do
something like
$array = array(
spl_object_hash($object1) => array('object' => $object1, 'data' => /* ...*/),
spl_object_hash($object2) => array('object' => $object2, 'data' => /* ...*/),
/*...*/
);
The only thing I can imagine is that we add support for objects
implementing ArrayAccess and Traversable (Iterator) on more places.
johannes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php