Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37786 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19101 invoked from network); 22 May 2008 02:13:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 May 2008 02:13:00 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:47413] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/10-18020-BA6D4384 for ; Wed, 21 May 2008 22:13:00 -0400 Received: from [83.228.56.37] (port=4168 helo=pc) by host.fmethod.com with esmtpa (Exim 4.68) (envelope-from ) id 1Jz0Ia-0005DN-9j for internals@lists.php.net; Wed, 21 May 2008 21:12:56 -0500 Message-ID: <0412F6FE505049F7901EAB8C61774839@pc> To: "PHP Developers Mailing List" Date: Thu, 22 May 2008 05:12:49 +0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0045_01C8BBCA.7AA990A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Short syntax for array literals [...] From: sv_forums@fmethod.com ("Stan Vassilev | FM") ------=_NextPart_000_0045_01C8BBCA.7AA990A0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable Hi, I hear this often by other developers and I tend to agree with them, = that arrays are used often, and often nested, so that having a long = syntax for array literals tend to produce less legible code than in = other scriping languages. $a =3D array(array(1,2), array(3,4), 5, 6); $b =3D array('a' =3D> 1, 'b' =3D>2); We use arrays in our configurations, in passing complex parameters to = functions, fetching information from databases, basically everything. So = it adds up. Some frameworks have somewhat funny attempts to remedy this by = introducing "shortcuts" like this: function a() { return = func_get-args(); }. Of course this doesn't work when you need to specify = the key name, and the overhead isn't worth it. It looks as there may not be a specific reason not to allow the JS = syntax as an alternative syntax (while keeping the current one in = parallel): $a =3D [[1, 2], [3, 4], 5, 6]; $b =3D ['a' =3D> 1, 'b' =3D>2]; There shouldn't be confusion to the parser as the brackets aren't = preceded by an identifier. Was this discussed before on the list? Regards,=20 Stan Vassilev ------=_NextPart_000_0045_01C8BBCA.7AA990A0--