#48112 [Opn->Bgs]: Printing a "++"

From: Date: Wed, 29 Apr 2009 20:52:45 +0000
Subject: #48112 [Opn->Bgs]: Printing a "++"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136522@lists.php.net to get a copy of this message
 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)

« previous php.bugs (#136522) next »