OK, this all stems from the good-old-days of assembler programming when we routinely - no, more than that, neccessarily had to use bit-masks to effect conditional branching in a program. Truth is that the binary code compiled from your source code still uses a bit-mask comparison to implement every Control Structure in your script/code/program.
Bit-masks use a logical AND or OR to compare bits in the mask with bits in the data.
To test for a specific bit position you use a mask with only that position set to 1 and a logical AND
mask: 00001000 = 0x08 = 8
test1: 11010111 = 0xE7 = 215
test2: 10011001 = 0x99 = 153
The mask here means that we only compare the 4th bit, and a logical AND returns FALSE for test1 because the 4th bit is OFF; it returns TRUE for test2 because the 4th bit is ON.
Now, there are some situations where this might be usefull in higher-level languages, but they are increasingly rare; and all could be implemented with other code constructs. Since bit-wise operations are not easy to read and comprehend, even for the person who wrote them originally, I would not recomend you use them in php; especailly as the logical comparison constructs are not complete in themselves but must be embedded within an IF or the like.
$mask = 0x08;
$var1 = 0xE7;
if (($mask & $var1) = $mask) {
// this IF executes because 4th bit is set in $var1
// [edit] and even as I'm writing it I get it wrong:
// does NOT execute cos 4th bit is OFF in $var1
// but you have to interpret the hex to see what is going on
}
A bigger bug-vector is hard to think of. It was a bug vector in assembler but back then we had to use them and worked with hex-binary-dec crib cards on out desks.
Bitmask Howto just to confirm how obscure this kind of coding is.