This one is faster and needs lesser memory.
function swap(&$a, &$b) {
$a = $a ^ $b;
$b = $a ^ $b;
$a = $a ^ $b;
}
$a = "One - 1";
$b = "Two - 2";
echo $a . $b; // One - 1Two - 2
swap($a, $b);
echo $a . $b; // Two - 2One - 1
Working example: http://codepad.viper-7.com/ytAIR4