#50649 [Opn]: negative offsets
| From: | aharvey@php.net | Date: | Mon, 04 Jan 2010 16:15:41 +0000 |
| Subject: | #50649 [Opn]: negative offsets | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146326@lists.php.net to get a copy of this message | ||
ID: 50649
Updated by: aharvey@php.net
Reported By: robert_xp at gmx dot net
Status: Open
Bug Type: Feature/Change Request
PHP Version: 5.3.1
New Comment:
For reference, functionality similar to this has been discussed at
least once before on the Internals mailing list:
http://marc.info/?l=php-internals&m=119123827510426&w=2
I'm not going to Won't Fix this, because unlike bug #50647, this hasn't
been denied via the RFC process. I'd suggest that writing an RFC to
start a discussion on Internals is probably the right way to go about
this (being a language change), rather than a feature request here.
Previous Comments:
------------------------------------------------------------------------
[2010-01-04 11:55:48] robert_xp at gmx dot net
Description:
------------
I heared somewhere, that string offsets will be removed in future
releases of PHP, as of 6.0. I like accessing single characters in a
C/C++ like way. If you pass a negative offset to strings, it would be a
good improvement to start at the end of the string, like the behavior of
substr().
The same is also possible for arrays, but I only focused on string
offsets here: http://www.xarg.org/2009/12/php-hacking/
Reproduce code:
---------------
$str = "Hello";
echo $str[-2].$str[-1].$str[0];
Expected result:
----------------
loH
Actual result:
--------------
Warnings
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50649&edit=1