Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37956 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83750 invoked from network); 28 May 2008 09:34:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 May 2008 09:34:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; 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:33685] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/FA-15519-B272D384 for ; Wed, 28 May 2008 05:34:36 -0400 Received: from [83.228.56.37] (port=4718 helo=pc) by host.fmethod.com with esmtpa (Exim 4.68) (envelope-from ) id 1K1I3E-0003FO-DL for internals@lists.php.net; Wed, 28 May 2008 04:34:32 -0500 Message-ID: <235A5092989F44D081FD64011EB5F5DC@pc> To: References: <0412F6FE505049F7901EAB8C61774839@pc> <483CFF33.6060302@lerdorf.com> <483D05B6.30804@daylessday.org> <200805281032.49016.et@php.net> <345fd5cd0805280147q73b46807vc9b6ad0778a96f9@mail.gmail.com> Date: Wed, 28 May 2008 12:34:26 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 7bit 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: Re: [PHP-DEV] Re: Short syntax for array literals [...] From: sv_forums@fmethod.com ("Stan Vassilev | FM") Hi, No one said it's a matter of life and death. But is it only a matter of life and death improvements that should be considered for PHP? The typical use case that benefits most from this is when a function accepts arrays as a means of structured/named/nested options, something I use a lot. Compare verbosity and readability: quoteInto('SELECT * FROM Table WHERE x > ? and y < ?', array(10, 50)); vs: quoteInto('SELECT * FROM Table WHERE x > ? and y < ?', [10, 50]); renderSomething(array('exclude' => array('a', 'b', 'c'), 'include' => array('d', 'e', 'f'))); vs: renderSomething(['exclude' => ['a', 'b', 'c'], 'include' => ['d', 'e', 'f']]); or even vs: renderSomething(['exclude' : ['a', 'b', 'c'], 'include' : ['d', 'e', 'f']]); The key thing is, no one is requesting that array() be removed. Just that an obvious and commonly used shortcut is added. It's not confusing, it's not hard, JavaScript also has BOTH short and long syntax for arrays and objects: var array = new Array(); -- same as -- var array = []; var object = new Object(); -- same as -- var object = {}; And when people have both of those, guess which one they use in more than 90% of the cases. Regards, Stan Vassilev > Hello, > > As I always will say -1 to this. > > But I have a question, people here talk that this is very very useful in > some cases. Can you please show others such cases so we can get your > point? > I really want to know this super hyper cases, this syntax is mega useful. > > Regards, Dimitar >