Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73718 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55673 invoked from network); 17 Apr 2014 13:16:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2014 13:16:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=admacedo@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=admacedo@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.172 as permitted sender) X-PHP-List-Original-Sender: admacedo@gmail.com X-Host-Fingerprint: 209.85.223.172 mail-ie0-f172.google.com Received: from [209.85.223.172] ([209.85.223.172:50809] helo=mail-ie0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4B/22-39661-144DF435 for ; Thu, 17 Apr 2014 09:16:50 -0400 Received: by mail-ie0-f172.google.com with SMTP id as1so344694iec.3 for ; Thu, 17 Apr 2014 06:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=6qTTeSJycdxG8fx58C3W41T3E4QXYO51iykTm2+Yauk=; b=dyK+GtvQaPG22sX0lg+e2x6vKrwCEwVP805PxGP3U3/8ZWZbCYGf1QxHsizk0wlo3b pesM7gaTB/fDcoccJC+8GrGBI/pxHkZGWVwviRGN/VqGQQuLm2XUfgPfNa7XoGSyJopF TSA/DnJY24ngdUb56zmuZu5/WHAwvuh9pKPtobtEu7G/hiMH8S8AAnkIUE3+U7Ml+pFE X2CjsIIZCbNo9XH5uDJS9zafD0dDdfoIblkMfud6P2mU6v3Ko2ZuoeBTRCfv6OROYotP SKzshW3Aktmzk9YB/0XeL1+qFZGwIBVKTQUSg5cKbwfKyC9VFGoeEJBoxEojqTTfyLqH 7D1g== X-Received: by 10.42.39.138 with SMTP id h10mr314365ice.92.1397740606242; Thu, 17 Apr 2014 06:16:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.17.162 with HTTP; Thu, 17 Apr 2014 06:16:06 -0700 (PDT) In-Reply-To: <4ED7146272E04A47B986ED49E771E347BBDA6AA22D@Ikarus.ameusgmbh.intern> References: <4ED7146272E04A47B986ED49E771E347BBDA6AA22D@Ikarus.ameusgmbh.intern> Date: Thu, 17 Apr 2014 14:16:06 +0100 Message-ID: To: Christian Stoller Cc: PHP Internals Content-Type: multipart/alternative; boundary=20cf30223f2952c9e704f73cd8ee Subject: Re: [PHP-DEV] Negative string offsets From: admacedo@gmail.com (Daniel Macedo) --20cf30223f2952c9e704f73cd8ee Content-Type: text/plain; charset=UTF-8 On Thu, Apr 17, 2014 at 2:11 PM, Christian Stoller wrote: > > On Thu, Apr 17, 2014 at 01:01:44PM +0100, Leigh wrote: > > > > > > What are peoples thoughts on allowing negative string offsets, that > > return > > > characters from the end of a string. > > > > > > Example: > > > > > > $string = 'foobar'; > > > print $string[-1]; // prints 'r'; > > > print $string[-2]; // prints 'a'; > > > > Generally I like this, but I think it's confusing and inconsistent in > comparison to array-indiexes, as you can have an array like `array(-1 => > 'foo')` > > And in my opinion one should not have differences in $string[x] and > $array[x] access. > That's an interesting notion, but I think in previous discussions the consensus was that array-index access and string offset were never going to be the same since non numeric array keys or multi-associative, etc don't translate to string offsets anyway. Can't remember how long/in regards to what this was, though! --20cf30223f2952c9e704f73cd8ee--