Re: Re: Negative string offset support

From: Date: Fri, 29 Oct 2004 23:21:05 +0000
Subject: Re: Re: Negative string offset support
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-13612@lists.php.net to get a copy of this message
At 01:05 AM 10/30/2004 +0200, Derick Rethans wrote:
On Fri, 29 Oct 2004, Greg Beaver wrote: Ilia Alshanetsky wrote:
I am wondering what are people's opinions on adding support for negative string offsets that could be used to access data from the end of a
string.
Ex. $a = "123"; echo $a[-1]; // would print 3 I don't think we should do this for arrays, since -1 and similar are valid array keys, which means adding this support for arrays would break BC.
I need this, +1 How can you *need* this, you can use substr() just fine.
Yeah, I also thought the word "need" is a bit strong :) It's more like "syntactic sugar which is nice-to-have" Andi

« previous php.internals (#13612) next »