Attributed to Solomon W. Golomb; a method for swapping the values of two integer variables without using an intermediate variable (you can tell this dates from the Elder Days, when variables were expensive!). Thanks to PHP's syntax it's also a one-liner.
$a^=$b^=$a^=$b;
Okay, here's how it goes (yeah, like I need to make content-free posts just for the sake of an increment...).
First, simplify the line; noting that ^= is right-associative, which means that in that line the rightmost operator is evaluated first, that the assignment operators also return the value that they assign to their lvalue, and that foo^=bar is shorthand for foo=foo^bar:
Code:
<br>$a^=$b^=$a^=$b;<br>$a^=($b^=($a^=$b));<br>$a=$a^b;<br>$a^=($b^=$a);<br>$a=$a^$b;<br>$b=$b^$a;<br>$a=$a^$b;<br>