php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54635 Decrementing character variables does not work as expected
Submitted: 2011-04-29 15:57 UTC Modified: 2011-04-29 17:34 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: reto dot kohli at comvation dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: Irrelevant OS: win32
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: reto dot kohli at comvation dot com
New email:
PHP Version: OS:

 

 [2011-04-29 15:57 UTC] reto dot kohli at comvation dot com
Description:
------------
In the documentation (http://www.php.net/manual/en/language.operators.increment.php), "Example #1 Arithmetic Operations on Character Variables" shows how strings can be incremented.
You would expect this to work the opposite way, too -- however, it doesn't.
See the modified code from Example #1 attached.


Test script:
---------------
$i = 'W';
for ($n=0; $n<6; $n++) {
    echo --$i . "\n";
}


Expected result:
----------------
V
U
T
S
R
Q


Actual result:
--------------
W
W
W
W
W
W


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-29 15:59 UTC] reto dot kohli at comvation dot com
-Status: Open +Status: Closed
 [2011-04-29 15:59 UTC] reto dot kohli at comvation dot com
It is documented...  :(
 [2011-04-29 17:34 UTC] dtajchreber@php.net
-Status: Closed +Status: Bogus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC