PHP has some functions to help with this, primarily decbin() (https://www.php.net/manual/en/function.decbin.php) which will convert an integer to binary. You can then break that up into an array which will be numbered by the Text_ values from your example.
$input = 48; $output = array_reverse(str_split(decbin($input))); foreach ($output as $k => $v) { echo $v ? "Text_$k".PHP_EOL : ""; }
So decbin(48) would give 110000, which you can break into the following array with str_split():
Array ( [0] => 1 [1] => 1 [2] => 0 [3] => 0 [4] => 0 [5] => 0 )
But you can see this is backwards - in binary we number the bits from right to left, not left to right. So you need to reverse it, using array_reverse().
Then you have a nice array of Text_ => active (1 or 0) pairs:
Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 1 [5] => 1 )
Text_5andText_4or32and16? Or Both?