Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62665 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44524 invoked from network); 2 Sep 2012 09:27:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2012 09:27:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 213.123.20.128 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 213.123.20.128 c2bthomr10.btconnect.com Received: from [213.123.20.128] ([213.123.20.128:35536] helo=mail.btconnect.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/E5-17065-89623405 for ; Sun, 02 Sep 2012 05:27:52 -0400 Received: from host81-138-11-136.in-addr.btopenworld.com (EHLO _10.0.0.5_) ([81.138.11.136]) by c2bthomr10.btconnect.com with ESMTP id IZD54557; Sun, 02 Sep 2012 10:27:48 +0100 (BST) Message-ID: <50432692.9070000@lsces.co.uk> Date: Sun, 02 Sep 2012 10:27:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120604 Firefox/13.0 SeaMonkey/2.10 MIME-Version: 1.0 To: "internals@lists.php.net" References: <13095916.1346546580825.JavaMail.root@wamui-haziran.atl.sa.earthlink.net> <5042B7F5.7030409@sugarcrm.com> <50431837.7060106@lsces.co.uk> <5043218F.2060503@sugarcrm.com> In-Reply-To: <5043218F.2060503@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A010302.50432693.0027, actions=tag X-Junkmail-Premium-Raw: score=7/50, refid=2.7.2:2012.9.2.90324:17:7.944, ip=81.138.11.136, rules=__MOZILLA_MSGID, __HAS_MSGID, __SANE_MSGID, __FW_1LN_BOT_MSGID, __HAS_FROM, __USER_AGENT, __MIME_VERSION, __TO_MALFORMED_2, __TO_NO_NAME, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __CT, __CT_TEXT_PLAIN, __CTE, __ANY_URI, __URI_NO_MAILTO, __URI_NO_WWW, __CP_URI_IN_BODY, BODY_ENDS_IN_URL, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, RDNS_SUSP, BODY_SIZE_7000_LESS X-Junkmail-Status: score=10/50, host=c2bthomr10.btconnect.com X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0208.50432694.00FB:SCFSTAT14830815,ss=1,re=-4.000,fgs=0, ip=0.0.0.0, so=2011-07-25 19:15:43, dmn=2011-05-27 18:58:46, mode=multiengine X-Junkmail-IWF: false Subject: Re: [PHP-DEV] Re: Support negative indexes for arrays and strings From: lester@lsces.co.uk (Lester Caine) Stas Malyshev wrote: >> Stanislav I though that the discussion on adding this type of functionality to >> >strings was already a done deal? Despite the obvious problems it introduces. > I'm not sure what you mean by "done deal". There was this RFC: > https://wiki.php.net/rfc/strncmpnegativelen > but that wasn't implemented due to some objections. There's also a pull > about negative strings offset but no RFC and no vote was ever held on it. And obviously no 'we are not going to do this' ... It does get difficult at time to work out what IS still under discussion. I think I'm getting confused with the extra indicies bits that were added at some point? Accessing array stored string content by character index ... god this is getting complicated! >> >I've already pointed out why there is no way that this can be discussed in >> >connection with 'collection arrays' and so there does need to be a clean break >> >between the two for ANY discussion. I believe that PHP is the only language that >> >allows us to use -ve indices ( i.e. keys ) in arrays? That was one of the nice > Depending what you mean by "arrays". I'm sure any language that has maps > indexed by value would not exclude values equaling to negative numbers. > E.g. in python: > >>>> >>>a = {} >>>> >>>a[-2] = 1 >>>> >>>a > {-2: 1} I wonder if that was added because of the PHP methods? > I'm not sure we need or can do anything else for arrays. We maybe could > for strings, technically, though I'm not currently convinced that having > substr() we really need to. But if the vote goes other way, for strings > I think it may be OK, if we figure out what to do with out-of-the-string > offsets. 'Add an exception' ;) -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk