this is where bitwise operations can come in handy...watch this.
<?php
define("BASIC", 1);
define("SECONDARY", 2);
define("MOD", 4);
define("ADMIN", 8);
define("SUPER", 16);
define("ROOT", 32);
$mylevel = BASIC | SECONDARY | MOD;
$beginner = BASIC;
$root = ROOT;
if ( ($beginner & ROOT) > 0) {
echo "has root level permission.\n";
}
if ( ($mylevel & SECONDARY) > 0) {
echo "has secondary level.\n";
}
echo "The value of the mylevel person is $mylevel.\n";
echo "The value of the beginner person is $beginner.\n";
?>
so in short, you set your permission levels in powers of two, each level twice as high as the next. to check if a user has permission in a certiain level, you bitwise and the value you want to check, and their total value.
If a person is going to have access to all levels, then their numeric level is the sum of all the levels together.
i know i didnt explain that the best, and you should be very comfortable with binary and bit arithmetic, so if you have questions just ask.