Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85320 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1376 invoked from network); 20 Mar 2015 19:04:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 19:04:58 -0000 Authentication-Results: pb1.pair.com header.from=bowersbros@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bowersbros@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.180 as permitted sender) X-PHP-List-Original-Sender: bowersbros@gmail.com X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:38112] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/95-64120-95F6C055 for ; Fri, 20 Mar 2015 14:04:57 -0500 Received: by wibgn9 with SMTP id gn9so967278wib.1 for ; Fri, 20 Mar 2015 12:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iCOQcU50Liji/w1EqRS2XnACM3aNLFDjK+yhSw5M5wU=; b=mvSmUwQToPvx9D4sglXcWb6hJp+IqZktnJq3CmdjpleutFeuJHeyK8tGktaDVGQdJs 48JR5rgbKG0AmJD5q1frg1LXXomnlzPMu2yQiBwDnnVU9PDgyNRtJF9oSj5JlcBJCZ/O 2qTBECqnciqBS5iCwAgyRCTGjmy0C8wr+Bltg8Bael1YMhldZGMT7JcrxBtqipibjMDc GYORvqoGAsM0v8215XUTd/Y55GHJE93MV281lbT/yHbPwkfi0+ifjvmOg/2BO2QWfxGb XH4X7kWrZEurZmHmSX2XsscZV2HagqFzqC9jUigaGaeCTUZCIYHX7ASKCQZLeY9mJM4K pOWQ== MIME-Version: 1.0 X-Received: by 10.194.221.100 with SMTP id qd4mr160168443wjc.113.1426878294672; Fri, 20 Mar 2015 12:04:54 -0700 (PDT) Received: by 10.28.62.84 with HTTP; Fri, 20 Mar 2015 12:04:54 -0700 (PDT) In-Reply-To: <550C6422.6080009@gmail.com> References: <550B5A81.1090706@gmail.com> <550B7189.4040608@gmail.com> <7486C296-7535-4633-AFE2-02E7BBC67BC5@gmail.com> <550C1176.9050307@gmail.com> <550C1AE4.8090607@gmail.com> <550C1EC3.8000106@gmail.com> <550C317E.8020508@gmail.com> <550C6422.6080009@gmail.com> Date: Fri, 20 Mar 2015 19:04:54 +0000 Message-ID: To: Rowan Collins Cc: Leigh , PHP Internals Content-Type: multipart/alternative; boundary=001a11c3aa74e44b070511bcfdfc Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: bowersbros@gmail.com (Alex Bowers) --001a11c3aa74e44b070511bcfdfc Content-Type: text/plain; charset=UTF-8 Is everybody happy with the RFC being called 'Slice Operator', or is there a better name for it? On 20 March 2015 at 18:17, Rowan Collins wrote: > Leigh wrote on 20/03/2015 16:17: > >> >> For $thing[-1] I think this only works for strings (and I have this >> implemented, should probably RFC it) https://github.com/lt/php-src/ >> tree/string_negative_offset >> >> $thing[-1:] is in scope for arrays though >> >> > Why? Getting the last value of an array is just as useful as getting the > last character of a string. > > It doesn't work *with that syntax*, because -1 is a valid key, just as > $thing[0] can't mean "first value of array" because it already means "value > with key 0". That's why I propose a new syntax such as $thing[@0], > $thing[@-1], etc. > > Regards, > -- > Rowan Collins > [IMSoP] > --001a11c3aa74e44b070511bcfdfc--