Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54044 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3694 invoked from network); 18 Jul 2011 16:08:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2011 16:08:54 -0000 X-Host-Fingerprint: 134.29.239.140 140-239-29-134.minnesota.edu Received: from [134.29.239.140] ([134.29.239.140:22888] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/7D-08769-49A542E4 for ; Mon, 18 Jul 2011 12:08:52 -0400 Message-ID: <81.7D.08769.49A542E4@pb1.pair.com> To: internals@lists.php.net Date: Mon, 18 Jul 2011 11:08:39 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 134.29.239.140 Subject: PHP array shorthand changes: splice? From: justin.rovang@minnesota.edu (Justin Rovang) I've sifted through the RFC for the array shorthand changes which are quite nice. Something I'm sure has been brought up, but possibly not recently: shorthand array splice. Has there been any notion to the introduction of this feature in the future? The reason I bring this up is it seems that the proposed notation that uses a colon may eliminate, or complicate the introduction of this in the future. Most languages that support this always start with the start index, and either specify the length of splice, or the last element to splice to. e.g.: $array = [0: 'PHP', 1: 'internals', 2: 'mailing list']; /* Then a possible splice approach: */ $temp = $array[0 : 2]; $temp = $array[0, 2]; Now, this could be I simply don't know the behavior of the new syntax when used on top of an existing array, (Does $array[0=>'Test]; even do anything in terms of assignement?)