Re: Negative string offset support

From: Date: Fri, 29 Oct 2004 20:06:39 +0000
Subject: Re: Negative string offset support
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-13603@lists.php.net to get a copy of this message
Right, I was about to say that too. If we only did it for the {} operator it would encourage people to use that little-used operator thereby removing a source of confusion and at the same time the BC issues are minimal. -Rasmus On Fri, 29 Oct 2004, Sterling Hughes wrote: > why not add it with the {} operators then? > > -sterling > > > On Fri, 29 Oct 2004 15:07:05 -0400, Ilia Alshanetsky <ilia@prohost.org> 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. > > > > Ilia > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.internals (#13603) next »