Possible duplicate: What should be the output of echo ++$a + $a++
This question targets PHP 5.x.
In the manual: http://php.net/manual/en/language.operators.precedence.php#example-111
// mixing ++ and + produces undefined behavior
$a = 1;
echo ++$a + $a++; // may print 4 or 5
On what platform or version I can get 5 as a result ? It seems 4 is the logical and correct answer every time.
I know in Java this is not undefined behavior so I wish to know if this was solved in PHP 5.x also ?