An extension to my reply above. When you're using bits to represent settings you're packing them into a variable. That variable might be 16, 32, 64, etc. bits in length. The size of that variable determines how many preferences or permissions you can pack in there.
For instance, a 32-bit variable can represent 32 permissions with on / off settings.
If you have a preference that is more than on / off, maybe it's: very low, low, avg, high, very high. That's 5 settings for one permission / preference. How many bits are necessary to store 5 unique combinations? The answer is 3 bits:
001 - very low
010 - low
011 - avg
100 - high
101 - very high
Notice that we didn't use the values 000, 110, or 111.
Going back to our 32-bit number, if we were storing the previous preference / permission, 3 of the 32 bits would be taken by that preference. This leaves us with 29 more bits to work with; we could store 29 more on / off preferences or maybe 23 more on / off preferences and another preference that requires 6 bits (23 + 6 = 29).
As for how we would go about storing and retrieving such a preference:
<?php
define( 'PNAME_VLOW', 0x01 );
define( 'PNAME_LOW', 0x02 );
define( 'PNAME_AVG', 0x03 );
define( 'PNAME_HIGH', 0x04 );
define( 'PNAME_VHIGH', 0x05 );
define( 'PNAME_ALL', 0x07 );
$prefs = 0x00; // Set initial preferences
// A lot of code that modifies the value in $prefs
// Now determine which of PNAME the user has permission to do
switch( $prefs & PNAME_ALL ){
case PNAME_VLOW:
// very low
break;
case PNAME_LOW:
// low
break;
case PNAME_AVG:
// average
break;
// And so on...
}
?>
Notice now that instead of checking if the bit is turned on (Using $prefs & PNAME_const), we're checking which out of all the bits for the preference are on and which value they're equal to.