Swap
This algorithm exchanges the value of two variables.
function Swap(&$a, &$b) {
$a ^= $b;
$b ^= $a;
$a ^= $b;
}
Example
$a = 1025;
$b = -5579;
Swap($a, $b);
Output
a: -5579
b: 1025