How to SWAP values of two variables without using a third variable?

1. Arithmetic operation
2. Bitwise operation.

Arithmetic Operation:

Bitwise operation:
x = x XOR y
y = x XOR y
x = x XOR y
if we write them in computer language using caret (^) then it will look like

x = x ^ y
y = x ^ y
x = x ^ y

in shorter version:

x ^= y
y ^= x
x ^= y

in one line

x ^= y ^= x ^= y

so here is the command in php:

$x ^= $y ^= $x ^= $y

This is collected from http://www.mizanurrahman.com/2008/07/30/how-to-swap-values-of-two-variables-without-using-a-third-variable. You can get more details about these operation on his blog.