Bug #54635 [Opn->Csd]: Decrementing character variables does not work as expected

From: Date: Fri, 29 Apr 2011 13:59:45 +0000
Subject: Bug #54635 [Opn->Csd]: Decrementing character variables does not work as expected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160452@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54635&edit=1

 ID:                 54635
 User updated by:    reto dot kohli at comvation dot com
 Reported by:        reto dot kohli at comvation dot com
 Summary:            Decrementing character variables does not work as
                     expected
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Strings related
 Operating System:   win32
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

It is documented...  :(


Previous Comments:
------------------------------------------------------------------------
[2011-04-29 15:57:28] 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



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54635&edit=1


Thread (3 messages)

« previous php.bugs (#160452) next »