Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52603 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23361 invoked from network); 31 May 2011 22:09:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 May 2011 22:09:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=justin@justincarmony.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=justin@justincarmony.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain justincarmony.com from 74.125.83.170 cause and error) X-PHP-List-Original-Sender: justin@justincarmony.com X-Host-Fingerprint: 74.125.83.170 mail-pv0-f170.google.com Received: from [74.125.83.170] ([74.125.83.170:64811] helo=mail-pv0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/03-25701-C1765ED4 for ; Tue, 31 May 2011 18:09:34 -0400 Received: by pvh21 with SMTP id 21so2398467pvh.29 for ; Tue, 31 May 2011 15:09:30 -0700 (PDT) Received: by 10.68.12.37 with SMTP id v5mr2643758pbb.309.1306879769787; Tue, 31 May 2011 15:09:29 -0700 (PDT) Received: from [192.168.1.101] (c-24-10-180-216.hsd1.ut.comcast.net [24.10.180.216]) by mx.google.com with ESMTPS id c3sm388128pbk.61.2011.05.31.15.09.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 May 2011 15:09:28 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Tue, 31 May 2011 16:09:25 -0600 Cc: Matt Wilson , Ilia Alshanetsky , Rasmus , Sean Coates , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <38D3296F-A14D-4D54-ABFD-F1BF68F5C4A5@justincarmony.com> References: <4DE5368A.6050603@moonspot.net> <2BFFEAC1-395E-4101-9452-002E63DCFD91@seancoates.com> <4DE55AB7.9050206@lerdorf.com> To: dukeofgaming X-Mailer: Apple Mail (2.1084) Subject: Re: [PHP-DEV] RFC: Short syntax for Arrays (redux) From: justin@justincarmony.com (Justin Carmony) I agree with this. So the idea would be adding short hand object = notation for PHP, inspired by JSON, but we also allow for associative = arrays. So: $object =3D { 'var1': 'one', 'var2': 'two' }; // for an object $assoc_array =3D [ 'var1': 'one', 'var2': 'two' ]; // for an array // even mix and match $person =3D { 'name': 'Justin', 'city': 'Ogden' 'phones' : [ 'home': '555-3928', 'work': '555-3922' ] }; echo $person->phones['home']; // output: 555-3928 The other option is the [] shorthand would create an ArrayObject, so you = can interact with the object like an array or object. But I think it is = important that we make it possible to allow for array AND object = shorthand. Justin On May 31, 2011, at 3:56 PM, dukeofgaming wrote: > Guys, as I said earlier, not even javascript (from javascript object > notation, as in JSON) is 100% interoperable with JSON because single = quotes > are valid in javascript and not in json. I say ":" is way more cleaner = than > "=3D>" and it is a good opportunity to adopt it.