+ 2
Same same, but different
I have noticed that: //JS var x = 5; document.write(x * x++); will print 25, but //PHP $x = 5; echo $x * $x++; will output 30! now, this is something, so how a average programmer can explain this to his/her grandma?
4 Réponses
+ 1
It gets better, right?
http://php.net/manual/en/language.operators.precedence.php
You know, when it's not even consistent between versions of PHP... (rhetorical /sarcastic question).
+ 2
i have never worked with php, but this is really bad design if it's true.
all other languages follow order of operation. why php?
+ 1
It depends on the level of programming knowledge of the average programmer's grandma. (I think it would be an interesting study.)
0
I have noticed this on PHP challenge playground when I and my opponent both missed the correct answer. And the one who originally posted the question offered both 25 and 30 as solution, so he knew about that already....