#36524 [Opn]: Negative indexes in strings

From: Date: Sat, 25 Feb 2006 16:24:42 +0000
Subject: #36524 [Opn]: Negative indexes in strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93659@lists.php.net to get a copy of this message
ID: 36524 Updated by: derick@php.net Reported By: terrafrost at gmail dot com Status: Open Bug Type: Feature/Change Request Operating System: any PHP Version: 4.4.2 New Comment: This is planned for PHP 6: http://www.php.net/~derick/meeting-notes.html#cleanup-for-vs Previous Comments: ------------------------------------------------------------------------ [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 http://bugs.php.net/?id=36524&edit=1

« previous php.bugs (#93659) next »