Storing multiple options in a single variable (binary addition?)
Sorry but I have no idea what this is called and googleing "Binary Options" just brings back financial websites.
I want to store a set of options as an integer e.g.
Option 1 = 1
Option 2 = 2
Option 3 = 4
Option 4 = 8
So if I tick 1 & 3 the value is 5, or 2, 3 & 4 the value is 14.
I want to do this in PHP, is there a pre defined function for it or does anyone know a pseudo code example?
I can probably store the values without a problem as it's just addition, but I won't know how to then read them properly. I can't think of a simple way of doing it.
Also does anyone know what this is called so I could Google it a bit more.