This is a bit of OT for SO, because I'm not trying to solve a specific problem, but just to understand how something can be implemented. But I'm after the code, so let's see how this happens ...
Let's say we had a flag for each day of the week, and we decided to save any combination of these flags as one number, for example:
0 = no days 1 = Monday 2 = Tuesday 4 = Wednesday 8 = Thursday 16 = Friday 32 = Saturday 64 = Sunday 127 = everyday
How can this logic be implemented in PHP so that if I said β13β, PHP would know that it would only check the boxes on Monday, Wednesday, and Thursday?
php bitset
Strawberry
source share