我有兩個變量:$a
和$b
,我想要得到它們的異或。按位異或兩個變量
$a = bindec('00110111001010000011101000111010');
$b = bindec('00111110001101100011100100101011');
//(11110110111000011111110011101110) <---This is what I want
$c = $a^$b;
echo $c = decbin($c);
爲什麼它給我 '1001000111100000001100010001' 而不是 '11110110111000011111110011101110'?
http://www.php.net/manual/en/language.operators.bitwise.php – fvu