Essentially it does this:
# let's assume some values for the sake of discussion $a = 'foo'; $b = 'bar'; $a = $a ^ $b; # $a now contains both variables, $a and $b logical or'ed # together, so at this point a=foo^bar and b=bar $b = $a ^ $b; # logically or-ing them again (since b still contains bar) # returns the original value of a, so now a=foo^bar # and b=foo $a = $a ^ $b; # then we logical-or the combined value with b, which now # contains our original a value. this returns the # original b value, so now a=bar and b=foo
It's one of those things that you can look at a dozen times, and suddenly your brain just goes 'ah ha!'.
Update: Of course read 'exclusive or (or xor)' everywhere that I said 'logical or', it must be bedtime.
| We're not surrounded, we're in a target-rich environment! |
|---|
In reply to Re: Re: Flying Obfu
by jasonk
in thread Flying Obfu
by awkmonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |