Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62698 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55659 invoked from network); 2 Sep 2012 23:11:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2012 23:11:11 -0000 Authentication-Results: pb1.pair.com header.from=slevy1@pipeline.com; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=slevy1@pipeline.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pipeline.com from 209.86.89.62 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: slevy1@pipeline.com X-Host-Fingerprint: 209.86.89.62 elasmtp-dupuy.atl.sa.earthlink.net Linux 2.4/2.6 Received: from [209.86.89.62] ([209.86.89.62:48875] helo=elasmtp-dupuy.atl.sa.earthlink.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/3C-17065-E87E3405 for ; Sun, 02 Sep 2012 19:11:10 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=pipeline.com; b=NA7ET/P9eBsM1qj7Gwg+siRvKV+lBnw/RHOlZais7TxSQHwuWrzpOBI0md2RyW+z; h=Message-ID:Date:From:Reply-To:To:Subject:Cc:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:X-ELNK-Trace:X-Originating-IP; Received: from [209.86.224.68] (helo=wamui-hunyo.atl.sa.earthlink.net) by elasmtp-dupuy.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1T8JJr-0000MC-Ve; Sun, 02 Sep 2012 19:11:07 -0400 Received: from 216.175.89.12 by webmail.c.earthlink.net with HTTP; Sun, 2 Sep 2012 19:11:06 -0400 Message-ID: <23535266.1346627467279.JavaMail.root@wamui-hunyo.atl.sa.earthlink.net> Date: Sun, 2 Sep 2012 19:11:06 -0400 (EDT) Reply-To: slevy1@pipeline.com To: Stas Malyshev Cc: "internals@lists.php.net" Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: EarthLink Zoo Mail 1.0 X-ELNK-Trace: ad108fc9e0b7e924cd4e711cd2c36696836f38a9c52816aea35d13c07a097d61b908f1eb8c6dcd58350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 209.86.224.68 Subject: Re: [PHP-DEV] Re: Support negative indexes for arrays and strings From: slevy1@pipeline.com >I see how this may work for strings and simple vectors, but what about this: > >$a = array(-1 => "foo", -2 => "bar"); echo $a[-1]; > >It should keep returning "foo", right? So then the question is - what >$array[-1] actually means? Context would be the deciding factor, i.e. perhaps restrict the shortcut's applicability to only a positive sequence of numbers for an indexed array's keys, as follows: $a = array(10 => "pen", 11 => "heaven"); echo $a[-1]; // "heaven" >guess if somebody wrote an RFC on that it'd make understanding it >easier. I see that the patch seems to address just the string part - but >the subject also mentions arrays. I think making it clear would be helpful. I'd appreciate if someone possessing RFC "karma" would step forward and put together what should be a relatively simple proposal. And, it may be best to restrict it to just strings, too. You could call it: "RFC: Negative Indexing for Strings" Since Easen has generously provided the patch, writing this proposal should take max 10-20 minutes, if even that much. (And, if there were an RFC template that would make it even easier to do.) SL