The users on my website all have an "access" number that is used to give
them access to different parts of the site. Each bit represents a different
part of the site. So, if a user has an access of 10, which is 1010 in
binary, they have access to the parts of the site that are represented by
the second and fourth bit. You know, standard bit masking stuff.

So the part of the site that is represented by the second bit has a value of
2 (0010), and the part that is represented by the fourth bit has a value of
8 (1000)

BUT, for some reason when I do (2 & 10) its giving me a result of zero, when
I believe it should be doing (0010 & 1010) and giving me an answer of 0010
which is 2 in decimal.

With users with an access other than 10, say 9, or 8, or 7, it seems to
behave normally. What is going on? Is it treating the 10 as a binary 2?
These access values are stored in a mysql table as a standard INT, and they
are not UNSIGNED or BINARY.

Am I missing something?

Jeremy







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to