Crash, FYI, your code snippet does no work under PHP 5. In PHP 5, any number that overflows the integer limit is turned to -1 when cast to an integer. So with your method, you will always get a final result of -1 under PHP 5 on a 32 bit system when $x overflows the integer limit.
Maybe this will hep explain why:
/**
* 4653896912 overflows the
* 32bit integer limit, so
* $x is now a float
*/
$x = 4653896912;
/**
* $x, a float, is converted
* to an integer for the
* bitwise operation.
* But, as an integer, $x
* overflows a 32bit system, so
* -1 is returned.
* The result is then -1, since
* -1 & 0xFFFFFFFF = -1
*/
$y = $x & 0xFFFFFFFF;
/**
* $y here is -1.
* And -1 shifted any amount to
* the right is -1, so the answer
* is -1
*/
$z = $y >> 13;
/**
* echos -1
*/
echo $z;
laserlight's suggestion will work fine on PHP 5 though.
You could do a XOR the same way by using its mathematical formula, which I don't know off the top of my head, but I'm sure can be found online.