Hello,
I want to use the bit system to check value
Sample :
$var=8;
if ($var&4) echo "var&4" ; else echo "! var&4" ;
Why this test return "! var&4" ... ? the var content 4 ... Could you please help me
cedric pelloquin from switzerland
I'm not sure you understand bits. 8 is a binary string like this:
1000
4 is a binary string like this:
0100
so, anding them bitwise gets:
1000 & 0100 = 0000
Now, if you and 15 and 4, you'll get:
1111 & 0100 = 0100