Req #36524 [Asn->Csd]: Negative indexes in strings

From: Date: Mon, 07 Mar 2016 11:52:31 +0000
Subject: Req #36524 [Asn->Csd]: Negative indexes in strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199644@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: francois@php.net Reported by: terrafrost at gmail dot com Summary: Negative indexes in strings -Status: Assigned +Status: Closed Type: Feature/Change Request Package: Strings related Operating System: * PHP Version: * Assigned To: francois Block user comment: N Private report: N New Comment: Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Implemented in version 7.1 Previous Comments: ------------------------------------------------------------------------ [2015-01-09 00:12:52] ajf@php.net PHP 6 was scrapped. Will this happen eventually? ------------------------------------------------------------------------ [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 (#199644) next »