here's a fast alternative to compute the xor-value of two bitstrings of an arbitrary (but same) length.
<?php
/**
* xor-op for bitstrings of arbitrary length
* bitstrings must have same length
*
* @param string $o1
* @param string $o2
* @return string
*/
function bitxor($o1, $o2) {
$xorWidth = PHP_INT_SIZE*8;
$o1 = str_split($o1, $xorWidth);
$o2 = str_split($o2, $xorWidth);
$res = '';
$runs = count($o1);
for($i=0;$i<$runs;$i++)
$res .= decbin(bindec($o1[$i]) ^ bindec($o2[$i]));
return $res;
}
?>