Bitsel işlem hatası?

0 Cevap php

I'm developping a site for fun and I'm trying to implement a directory access control based on bitwise operators.
I've defined GUEST = 1, GROUP1 = 15 and GROUP2 = 23

Ben karşılaştırırsanız

echo (23 & 1); // print 1 

ama GUEST, GROUP1 tanımlayan ve GROUP2 ise:

define('GUEST', 1);  
define('GROUP1', 15);  
define('GROUP2', 23);  
// and then  
echo (GROUP2 & GUEST); // print 0  
echo USER_GUEST.','.USER_ROLES1.','.USER_ROLES2; // print 1,15,23` 

Ile GROUP1 sorun:

echo (GROUP1 & GUEST); print 1.  

Where do I'm wrong ? some suggestion ? Thanks.


I've discovered something really strange: my GUEST, GROUP1 and GROUP2 are declared inside an ini file which I parse by a function parse_ini_file(self::$fileName, true); within a class . After I've parsed the file I define recursively the couples key=value defined under section [DEFINE] (a simply trick). If I comment there my GROUP2=23 definition and I declare it inside the current script (GROUP2 & GUEST) return 1!

0 Cevap