Req #36524 [Opn]: Negative indexes in strings

From: Date: Fri, 09 Jan 2015 00:12:52 +0000
Subject: Req #36524 [Opn]: Negative indexes in strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189798@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=36524&edit=1 ID: 36524 Updated by: ajf@php.net Reported by: terrafrost at gmail dot com Summary: Negative indexes in strings Status: Open Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues -Operating System: any +Operating System: * -PHP Version: 4.4.2 +PHP Version: * Block user comment: N Private report: N New Comment: PHP 6 was scrapped. Will this happen eventually? Previous Comments: ------------------------------------------------------------------------ [2006-02-25 17:24:40] derick@php.net This is planned for PHP 6: http://www.php.net/~derick/meeting-notes.html#cleanup-for-vs ------------------------------------------------------------------------ [2006-02-25 06:55:37] terrafrost at gmail dot com Description: ------------ Currently, in PHP, if you want to reference the last character of a string, you'd need to do something like $x{strlen($x)-1}. If using substr, however, you can do substr($x,-1,1) or substr($x,strlen($x)-1,1). In keeping with the former substr example, $x{-1} could be made to access the last character of a string as well. Since, right now, using negative numbers will result in a warning, it seems unlikely that any existing code is going to be broken by such a change... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=36524&edit=1

« previous php.bugs (#189798) next »