Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27734 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67476 invoked by uid 1010); 4 Feb 2007 11:24:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67461 invoked from network); 4 Feb 2007 11:24:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2007 11:24:29 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.230 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 64.233.162.230 nz-out-0506.google.com Linux 2.4/2.6 Received: from [64.233.162.230] ([64.233.162.230:23821] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/FB-54400-D62C5C54 for ; Sun, 04 Feb 2007 06:24:29 -0500 Received: by nz-out-0506.google.com with SMTP id k1so1390805nzf for ; Sun, 04 Feb 2007 03:24:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=a3OaeZBVNbCmFtte96xRUFTF7Rgo1hirtsDbYDMx+F1zJrYA2h/eOx2qO9I5aoQzO7M9vzifzfoi6D/Gz/yu65Vdg2cI7IbOOCEvty8IVq/oHrRie3+bmu5F7Kf/5YAynQnlj3uEI5uOXzeZ12ncKP34fSff3i6ZlkP12lYzGGM= Received: by 10.65.43.5 with SMTP id v5mr8946064qbj.1170588266475; Sun, 04 Feb 2007 03:24:26 -0800 (PST) Received: by 10.65.185.15 with HTTP; Sun, 4 Feb 2007 03:24:26 -0800 (PST) Message-ID: Date: Sun, 4 Feb 2007 12:24:26 +0100 To: "Andi Gutmans" Cc: internals@lists.php.net In-Reply-To: <011701c7482d$a39f6910$6500a8c0@zend.2k> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <011701c7482d$a39f6910$6500a8c0@zend.2k> Subject: Re: [PHP-DEV] Syntactic improvement to array From: pierre.php@gmail.com (Pierre) Hi Andi, On 2/4/07, Andi Gutmans wrote: > 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. I like this syntax, it is clear and easy to write. All other languages use this syntax already (using either {} or [] but same principle) and it can be done while keeping the classic array() definition. No need to mention the numerous requests to add it to php. --Pierre