Very strange PHP | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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

2nd Mar 2020, 9:00 PM
BodyaBuilder
BodyaBuilder - avatar
2 Respostas
2nd Mar 2020, 11:45 PM
MO ELomari
0
Thanks!
3rd Mar 2020, 3:54 AM
BodyaBuilder
BodyaBuilder - avatar