|
Posted by Gordon Burditt on 04/11/07 22:42
>Yes, definately a syntax to avoid, seems unpredictable at best...
>
><?php
> $i = 2;
> echo $i++ + 1; /// i'd expect 4, gives 3, ignores ++ increment
Please get your expecter fixed. $i++ returns the value *BEFORE*
the increment. (If you want ++$i, you know where to find it.) This
one is unambiguous since all possible orders come up with the same
result.
For the other expressions involving $i++ and another reference to $i's
value to give a resource returning Donald Trump, who's going to find the
programmer and say "You're Fired".
[Back to original message]
|