Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27731 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9648 invoked by uid 1010); 4 Feb 2007 07:25:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9633 invoked from network); 4 Feb 2007 07:25:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2007 07:25:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=andi@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=andi@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: andi@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:31313] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/86-54400-96A85C54 for ; Sun, 04 Feb 2007 02:25:31 -0500 Received: (qmail 25514 invoked from network); 4 Feb 2007 07:23:47 -0000 Received: from localhost (HELO ANDILENOVO) (127.0.0.1) by localhost with SMTP; 4 Feb 2007 07:23:47 -0000 To: Date: Sat, 3 Feb 2007 23:25:22 -0800 Message-ID: <011701c7482d$a39f6910$6500a8c0@zend.2k> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-index: AcdILZ/LgWY/cYJ1QqaG1Uhj1j57+w== Subject: Syntactic improvement to array From: andi@zend.com ("Andi Gutmans") Hi, I thought I may have brought this up a long time ago but couldn't find anything in the archives. For a long time already I've been thinking about possibly adding a new syntax for array(...) which would be shorter. I'd suggest [...]. While I am usually not in favor of having more than one way to do things, I think it'd look much more elegant especially (but not only) for nested arrays. So what I'm thinking of is: array(1, 2, 3) == [1, 2, 3] array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]] array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2] $arr = [1, 2, 3] vs. $arr = array(1, 2, 3) Well enough examples given :) I think it's not worth doing unless there's overwhelming support as it's not desperately needed. But I'd be interested to hear people's thoughts. It seems implementation shouldn't be an issue but I'd have to dive a bit deeper. Andi