3 ms·
I don't use PHP much, but I was curious, so here's the answer you don't want: You get $a[1] = 0 the first way, and $a[0] = 0 the second way. PHP seems to eval
by harshreality 14y ago
I don't use PHP much, but I was curious, so here's the answer you don't want:
You get $a[1] = 0 the first way, and $a[0] = 0 the second way. PHP seems to evaluate the array index before the right hand side if there is something more than a $variable to evaluate; otherwise PHP evaluates the array index after the right hand side, after $i has been incremented.
I haven't used hiphop, but I'm curious if it preserves that disparity between arrays when translating to C++, or if it breaks PHP compatibility by making those two arrays equivalent.
- kmavm 14y agoThe entire point of my post was that we preserve the semantics of this (and many other) PHP-isms. We have to, because you never can tell which glitches useful code has come to depend on.