24.6k1414 gold signs9595 silver marks175175 bronze marks
Vovavova
eleven11 bronze sign
What do you expect? - dakiesse
The algorithm is just that.Post-increment (a ++) returns the value BEFORE adding one, ++ a - after.As a result, the first value is one less. - Sergey Snegirev
And that returns $a=10; $a=$a++ + ++$a;$a=10; $a=$a++ + ++$a;in pkhp?Expected 23, or more?Or again depends on the version of PHP? - Vesper
As far as I know, in C ++ this situation is undefined behavior.So the question is not so trivial.In a good answer, I would like to see a clear explanation of the order in which the operators are executed (including post-increment) in PHP. - Nick Volynkin ♦
$a=10; $a=$a++ + ++$a;$a=10; $a=$a++ + ++$a;in pkhp? Expected 23, or more? Or again depends on the version of PHP? - Vesper