I am trying to do bit operations and I am seeing some weird results in PHP. The following code:
Code:
echo "\n<!-- (".$array2['ID']." & ".$array['divisions'].") = ".($array2['ID'] & $array['divisions'])." == ".$array2['ID']." ::: ".((($array2['ID'] & $array['divisions']) == $array2['ID'])?"TRUE":"FALSE")."-->\n";
Outputs:
Code:
<!-- (8 & 11) = 0 == 8 ::: FALSE-->
I don't understand why be cause obviously 8 & 11 = 8. Sometimes this works fine:
Code:
<!-- (8 & 9) = 8 == 8 ::: TRUE-->
<!-- (4 & 5) = 4 == 4 ::: TRUE-->
Actually it only works fine when b = a+1 when (a & b) = a
Is & actually something else besides AND in PHP?