#48112 [Opn->Bgs]: Printing a "++"
ID: 48112
Updated by: rasmus@php.net
Reported By: colin at shuaige dot org
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: Windows Server 2003 (and others)
PHP Version: 5.2.9
New Comment:
You have discovered the post-increment operator.
Suggested reading:
http://www.php.net/manual/en/language.operators.increment.php
Previous Comments:
------------------------------------------------------------------------
[2009-04-29 20:34:30] colin at shuaige dot org
Description:
------------
Printing a short-hand addition statement ("++") produces the value of
the integer before the statement was run instead of the integer "+ 1".
Reproduce code:
---------------
$test = 0;
echo $test++;
// produces "0"
echo $test;
// produces "1"
Expected result:
----------------
$test = 0;
echo $test++;
// produces "1"
echo $test;
// produces "1"
Actual result:
--------------
$test = 0;
echo $test++;
// produces "0"
echo $test;
// produces "1"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48112&edit=1
Thread (2 messages)