After much searching, I found this entry on bitmasks. So here's what I do:
This code will give me yes/no/no. If I change it to:
then it works and I get no/no/yes. Just a little confused, can anybody explain?
define("SECT1",1);
define("SECT2",2);
define("SECT3",4);
$usermask = bindec('001');
echo (SECT1 & $usermask ? "yes" : "no") . "<br />\n";
echo (SECT2 & $usermask ? "yes" : "no") . "<br />\n";
echo (SECT3 & $usermask ? "yes" : "no") . "<br />\n";This code will give me yes/no/no. If I change it to:
$usermask = bindec(strrev('001'));then it works and I get no/no/yes. Just a little confused, can anybody explain?
