From: robert_xp at gmx dot net Operating system: PHP version: 5.3.1 PHP Bug Type: Feature/Change Request Bug description: negative offsets
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 bug report at http://bugs.php.net/?id=50649&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50649&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50649&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50649&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50649&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50649&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50649&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50649&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50649&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50649&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50649&r=support Expected behavior: http://bugs.php.net/fix.php?id=50649&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50649&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50649&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50649&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50649&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50649&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50649&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50649&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50649&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50649&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50649&r=mysqlcfg
