Very strange PHP | SoloLearn: Learn to code for FREE!

0

Very strange PHP

That's interesting, and I want to know why is it happening in that way. I have a code: $a = 9; echo $a++; It outputs 9, and then increases the value. $a = 9; echo $a + $a + $a++; It outputs 27, and that's right: 9 + 9 + $a++ where $a++ outputs 9 and then increases the value. But here: $a = 9; echo $a + $a++; The output will be 19, why? It should be 18, shouldn't it? I don't get it

3/2/2020 9:00:56 PM

PHPenguin

2 Answers

New Answer

0

https://gist.github.com/nikic/6699370

0

Thanks!