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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 26 17:01:25 2020 UTC