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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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 18 08:01:33 2024 UTC