Volmar Machado <qi.vol...@gmail.com> wrote:
>When the one of the operators were 2, the cases with "<------------"
>returns 2 otherwise returns 0 (Or 1 when any operator is 1). And if
>the operators are 1 and 2, return 0 too. Its curious for me.

& is the bitwise and operator. You have to look at the binary
representation of the numbers to see what is happening:
2 decimal is 0010 binary
1 decimal is 0001 binary

2 & 1 == 0010 & 0001 == 0000 == 0

In your other examples you had
2 & 3 == 0010 & 0011 == 0010 == 2
and
4 & 3 == 0100 & 0011 == 0000 == 0

Does this help?

Bye, Andreas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to