#42230 [Opn->Bgs]: echo ++$var output differs from $var++
| From: | derick@php.net | Date: | Tue, 07 Aug 2007 07:43:55 +0000 |
| Subject: | #42230 [Opn->Bgs]: echo ++$var output differs from $var++ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115822@lists.php.net to get a copy of this message | ||
ID: 42230
Updated by: derick@php.net
Reported By: simon@php.net
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: debian linux
PHP Version: 5.2.4RC1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2007-08-07 07:40:15] simon@php.net
Description:
------------
different result from echoing post or pre incrementation of a variable
$count=1;
echo $count++;//echo's 1
echo "\n";
$count=1;
echo ++$count;//echo's 2
its hard to see where this would really be an issue
& yes the value of $count is still the same in both scenarios, just
seems inconsistent behaviour and could confuddle some basic debugging ?
Reproduce code:
---------------
$count=1;
echo $count++;
echo "\n";
$count=1;
echo ++$count;
Expected result:
----------------
2
2
Actual result:
--------------
1
2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42230&edit=1