Bitmask Magic 1.0
This class is designed to create bitmasks, which are very commonly used to store lists of true or false values as a single integer.
The class can manpulate bitmasks that are not limited to 32 bits. It does not need the PHP gmp extension to provide arbitrary bit length support.
This absence of limits may encourage the storage of more complex data than merely true or false lists for those that are creative enough to figure it out.
Although PHP programmers commonly rely on databases to do much of the grunt work that is most commonly done by bitmasks in other types of programming, there is nothing better for tracking things such as user permissions, product options, and I have even used them to trace complex data structures.
- Convert arrays of booleans to bitmasks
- Convert bitmasks to booleans
- Convert bitmasks to arrays of booleans
- Store virtually unlimited bit depth bitmasks in string form
- Query individual bits to see if they are set
- Enter an associative array, manipulate bits and return the array in either the full array or only the values that are set