Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79711 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93416 invoked from network); 16 Dec 2014 11:05:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2014 11:05:47 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:48456] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B6/63-07463-A0210945 for ; Tue, 16 Dec 2014 06:05:46 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 2EF462400AA; Tue, 16 Dec 2014 06:05:43 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qpG0qYTqh1_Y; Tue, 16 Dec 2014 06:05:43 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 7CE9A2400C7; Tue, 16 Dec 2014 06:05:42 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Tue, 16 Dec 2014 11:05:40 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <216D6925-EB1A-49E0-AD6B-42100C2F81DB@ajf.me> References: <548FEE87.7020602@gmail.com> <549009EE.7040808@fischer.name> To: Markus Fischer X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC][VOTE] Objects as Keys From: ajf@ajf.me (Andrea Faulds) >=20 > On 16 Dec 2014, at 10:52, Andrea Faulds wrote: >=20 > Exactly. If I were to do this: >=20 > class Foo { > public $foo; > function __construct($foo) { > $this->foo =3D $foo; > } > function __toKey() { > return $this->foo; > } > } > $arr =3D []; > $arr[] =3D new Foo(1); > var_dump($arr); >=20 > I would get this: >=20 > array(1) { > [0]=3D> > int(1) > } Er, a correction=E2=80=A6 the example should=E2=80=99ve been something = like this: $arr =3D []; $arr[new Foo(1)] =3D NULL; Producing this: array(1) { [1]=3D> NULL } Obviously, it has no effect on values, only keys, sorry! -- Andrea Faulds http://ajf.me/