Edit report at https://bugs.php.net/bug.php?id=65580&edit=1
ID: 65580 Updated by: ahar...@php.net Reported by: xiezhenye at gmail dot com Summary: reference will affect expression result with multiple ++$x -Status: Open +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Any PHP Version: 5.5.3 Block user comment: N Private report: N New Comment: This is undefined behaviour in PHP, as in most languages with C-derived syntaxes, due to the lack of a sequence point between the post-increments. Mailing list discussion from last month: http://marc.info/?t=137427934300002&r=1&w=2 This is also documented, see example 1 on: http://www.php.net/manual/en/language.operators.precedence.php Previous Comments: ------------------------------------------------------------------------ [2013-08-29 02:58:28] xiezhenye at gmail dot com Description: ------------ reference will affect expression result with multiple ++$x. Test script: --------------- $a = 1; echo (++$a)+(++$a); $a = 1; $b = &$a; echo (++$a)+(++$a); Expected result: ---------------- 55 Actual result: -------------- 56 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65580&edit=1