Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49224 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64256 invoked from network); 9 Aug 2010 11:44:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Aug 2010 11:44:08 -0000 Authentication-Results: pb1.pair.com header.from=mathieu.suen@easyflirt.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mathieu.suen@easyflirt.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain easyflirt.com designates 91.199.255.56 as permitted sender) X-PHP-List-Original-Sender: mathieu.suen@easyflirt.com X-Host-Fingerprint: 91.199.255.56 python-06.easyrencontre.com Linux 2.6 Received: from [91.199.255.56] ([91.199.255.56:52567] helo=mail.easyflirt.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/5D-63845-50AEF5C4 for ; Mon, 09 Aug 2010 07:44:06 -0400 Received: from [192.168.0.51] (office.easyrencontre.com [78.155.152.6]) by mail.easyflirt.com (Postfix) with ESMTPSA id 48D366374FD for ; Mon, 9 Aug 2010 13:44:03 +0200 (CEST) Message-ID: <4C5FEA03.8010801@easyflirt.com> Date: Mon, 09 Aug 2010 13:44:03 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-Version: 1.0 To: PHP internals References: <4C5C1D2E.6070805@easyflirt.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------050003050901000400060404" Subject: Re: [PHP-DEV] Indexing an array From: mathieu.suen@easyflirt.com ("mathieu.suen") --------------050003050901000400060404 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08/06/2010 04:42 PM, Gustavo Lopes wrote: > On Fri, 06 Aug 2010 15:33:18 +0100, mathieu.suen > wrote: > >> Hi, >> >> For now you can only index an array using a scalar type or a string. >> Is there some rfc or work going on to enlarge the possibility so that it >> is possible to have some other object like: >> >> - closure >> - object >> - etc. > > I think the problem with that is how you are going to generate the > hash of arbitrary objects in order to store them in the hash table. > It's not like all PHP objects have a hashCode() method. IMHO It should. > > So the only plausible option would be to attribute the same hash to > all and the test all for equality on an insertion with a new key or in > the worst case scenario for updates and reads. > Since php is not referentially transparent I would rather use identity unless object can redefine equality. -- Mathieu Suen --------------050003050901000400060404--