I've come across a (seemingly) very strange case.
Take the number 2 (0b10
) and bitmask it with 1 (0b01
)
This should produce 0b00
which is equivalent to 0.
However, here's where Mr Schrödinger comes in:
var_dump(0b10 & 0b01); // int(0)
var_dump(0b10 & 0b01 == 0); // int(0)
var_dump(0b10 & 0b01 != 0); // int(0)
Whiskey. Tango. Foxtrot.
I am, admittedly, not the sharpest when it comes to bitwise operators - so maybe I've got horribly, horribly wrong somewhere?
However, in Python:
0b10 & 0b01 == 0
= True
0b10 & 0b01 != 0
= False
...so?