I grant permissions for persons like this:
$ARR_PERSON = array(
2 => "Person B",
4 => "Person C",
8 => "Person D",
16 => "Person E",
32 => "Person F",
);
The problem is I don’t know how to get the permission when I have a number. For example: 24. How to split it into 8 and 16? I can’t think out the solution.
Using bitwise operations. When
PERMISSION & MASKis nonzero (e.g,24 & 16), the flag is set. When it is zero, the flag is not set.