operators - In php why is it the case that 10 & 10 == 10 returns 0? -
I am messing with PHP operators and I do not understand why
< Code> 10 & amp; 10 == 10
Returns 0. It should be 10 to 10 which is right?
Comparison operator is from bitwise operators, so that expression can be evaluated:
< Pre> 10 & amp; (10 == 10)
10 == 10 evaluates the correct, so you get the 10 & amp; True . Bitwise turns and to true to 1 , so you'll see the 10 & amp; 1 which is 0 .
Note that 11 & amp; 10 == 10 result in 1 , because 11 & amp; 1 === 1 .
Comments
Post a Comment