Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62735 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60251 invoked from network); 3 Sep 2012 12:41:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 12:41:23 -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.64 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.64 elasmtp-curtail.atl.sa.earthlink.net Linux 2.4/2.6 Received: from [209.86.89.64] ([209.86.89.64:59787] helo=elasmtp-curtail.atl.sa.earthlink.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/D7-20751-275A4405 for ; Mon, 03 Sep 2012 08:41:22 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=pipeline.com; b=SYwRG2+YgrQh4wsglaGwqrWnE50bCeEXFk5ddgWT8ADSef4SyaztjY/gFapQvH7z; 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.65] (helo=wamui-june.atl.sa.earthlink.net) by elasmtp-curtail.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1T8Vxv-0000mA-23; Mon, 03 Sep 2012 08:41:19 -0400 Received: from 216.175.78.247 by webmail.c.earthlink.net with HTTP; Mon, 3 Sep 2012 08:41:18 -0400 Message-ID: <4477847.1346676078470.JavaMail.root@wamui-june.atl.sa.earthlink.net> Date: Mon, 3 Sep 2012 08:41:18 -0400 (EDT) Reply-To: slevy1@pipeline.com To: Jannik Zschiesche 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: ad108fc9e0b7e924cd4e711cd2c36696836f38a9c52816ae23df255a9b41a6a189cb85e3534d2ef3350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 209.86.224.65 Subject: Re: [PHP-DEV] Re: Support negative indexes for arrays and strings From: slevy1@pipeline.com >as I understood, a lot of people seem to have problems with this proposal, since arrays and strings could (and maybe >should) behave the same. The terminology "negative indexing" seems to imply that the feature should work with arrays. To restrict it to just strings might involve creating a term one would only associate with strings. >The main problem arises from the ambiguity for $array[-1] for arrays. >But this is easily solvable: just introduce a slice operator. > >$array[:-1] and the ambiguity is gone. Thanks for that suggestion! On the one hand, negative indexing alone is simpler and less prone to typos, but it makes sense that using the slice operator would clarify the code. SL