|  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
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-07 14:32 UTC]
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-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 25 08:03:33 2021 UTC