php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48112 Printing a "++"
Submitted: 2009-04-29 20:34 UTC Modified: 2009-04-29 20:52 UTC
From: colin at shuaige dot org Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.9 OS: Windows Server 2003 (and others)
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: colin at shuaige dot org
New email:
PHP Version: OS:

 

 [2009-04-29 20:34 UTC] 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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-29 20:52 UTC] rasmus@php.net
You have discovered the post-increment operator.

Suggested reading: http://www.php.net/manual/en/language.operators.increment.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 13:01:30 2024 UTC