Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49227 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74022 invoked from network); 9 Aug 2010 12:37:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Aug 2010 12:37:00 -0000 Authentication-Results: pb1.pair.com header.from=johannes@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 217.114.211.66 as permitted sender) X-PHP-List-Original-Sender: johannes@php.net X-Host-Fingerprint: 217.114.211.66 ns.km36107.keymachine.de Solaris 10 (beta) Received: from [217.114.211.66] ([217.114.211.66:36514] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/5F-63845-B66FF5C4 for ; Mon, 09 Aug 2010 08:37:00 -0400 Received: from [192.168.1.31] (ppp-93-104-49-163.dynamic.mnet-online.de [93.104.49.163]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id E8BB22498D; Mon, 9 Aug 2010 14:36:56 +0200 (CEST) To: "mathieu.suen" Cc: RQuadling@googlemail.com, PHP internals In-Reply-To: <4C5FEAB7.7000603@easyflirt.com> References: <4C5C1D2E.6070805@easyflirt.com> <4C5FEAB7.7000603@easyflirt.com> Content-Type: text/plain; charset="UTF-8" Organization: php.net Date: Mon, 09 Aug 2010 14:36:50 +0200 Message-ID: <1281357410.969.294.camel@guybrush> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Indexing an array From: johannes@php.net (Johannes =?ISO-8859-1?Q?Schl=FCter?=) 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