Why should I use bitwise/bitmask in PHP?

后端 未结 8 1915
时光取名叫无心
时光取名叫无心 2020-11-30 20:54

I am working on a user-role / permission system in PHP for a script.

Below is a code using a bitmask method for permissions that I found on phpbuilder.com.

B

8条回答
  •  Happy的楠姐
    2020-11-30 21:17

    Try using what is in the bit.class.php at http://code.google.com/p/samstyle-php-framework/source/browse/trunk/class/bit.class.php

    Checking against a specific bit:

    
    

    And to turn on and off:

    
    

提交回复
热议问题