I have 5 different values which are saved as bits like 10010. I get the value as an Int from the Database (cannot change that) so like 24 means 11000 I know that i can get the biggest bit here by using
if ((decbin($d) & 16) == 16)
but if the first is 0 i would have to check the next bit, and if that is 0 i would have to ...
So after all i would have a block of ifs and if there were more bits the block was bigger. Is there a simple way to just get the "id" (or value, would not matter) of the highest bit with a 1?