Please see my other Database Development articles.
Using bits as flags.
Recording user settings, often as “categories” represents significant persistence within many applications.
Storing all these values within separate variables would waste valuable memory as well violate the Don’t Repeat Yourself (DRY) principle, producing hard-to-maintain code as well as tedious to understand.
We’ll begin our examples by simply creating two values and setting their values.
Reversing the bits for ‘1’ produce ‘2’ and doing the same for ‘3’ product ‘4’.