For example I have an integer
$mask = 210;
which in binary is
$binary = decbin($mask); // "11010010"
Now I want to convert this ($mask or $binary) to an array with the indexes which is true:
$expected = [2, 5, 7, 8];
What is the best way to do this?