In the above example, we evaluate the expression right to left.
Is that always, or just in this case? When are expressions evaluated left-to-right, and when right-to-left? And why is that so? I would have thought that do { $i = 0; ++$i + $i++; } would evaluate to 2 because (0 + 1) + 1 == 2, but apparently, I'm wrong.
Update: Got the concept right, but I evaluated in reverse order. Whoops! Juerd is right.
Answer to Ovid's update: No, I'm not, as do { $i = 0; ++$i + $i++ } does NOT equal 2 -- the right-to-left apparently is correct, I'm just wondering why it is that way.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
In reply to Re: Re: $i=$i++
by Juerd
in thread $i=$i++
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |