php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #36524 Negative indexes in strings
Submitted: 2006-02-25 06:55 UTC Modified: 2016-03-07 11:52 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: terrafrost at gmail dot com Assigned: francois (profile)
Status: Closed Package: Strings related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: terrafrost at gmail dot com
New email:
PHP Version: OS:

 

 [2006-02-25 06:55 UTC] 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...


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-25 17:24 UTC] derick@php.net
This is planned for PHP 6:
http://www.php.net/~derick/meeting-notes.html#cleanup-for-vs

 [2015-01-09 00:12 UTC] ajf@php.net
-Package: Feature/Change Request +Package: *General Issues -Operating System: any +Operating System: * -PHP Version: 4.4.2 +PHP Version: *
 [2015-01-09 00:12 UTC] ajf@php.net
PHP 6 was scrapped.

Will this happen eventually?
 [2015-01-09 00:13 UTC] ajf@php.net
-Package: *General Issues +Package: Strings related
 [2016-01-04 17:36 UTC] francois@php.net
-Assigned To: +Assigned To: francois
 [2016-03-07 11:52 UTC] francois@php.net
-Status: Assigned +Status: Closed
 [2016-03-07 11:52 UTC] francois@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC