php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #17077 Negative string indexing
Submitted: 2002-05-07 13:01 UTC Modified: 2002-05-07 14:32 UTC
Votes:5
Avg. Score:3.8 ± 1.0
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: csaba at alum dot mit dot edu Assigned:
Status: Suspended Package: Feature/Change Request
PHP Version: 4.2.0 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: csaba at alum dot mit dot edu
New email:
PHP Version: OS:

 

 [2002-05-07 13:01 UTC] csaba at alum dot mit dot edu
This is my third (and last, for now) enhancement request.  Please be patient with me - I am an ardent PHP fan.

The single biggest thing I would like to see for strings is to be able to provide a negative index, where $str{-1} means the last character, $str{-2} the penultimate character and so on down to $str[0] === $str[-strlen($str)]

It's just a convenince thing since I can already get there using substr or slice - it would just be a more compact way of writing it.

       Regards to the PHP team,
               Csaba Gabor

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-07 14:32 UTC] mfischer@php.net
Hi again :) This also was one of the great discussion points for the Zend Engine2. I suggest reading the archives (note to myself: where was the url again?) and eventually bringing this up again (php-dev@ or engine2). Suspending until.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC