fork(5) download
  1. <?php
  2. $expected = array();
  3.  
  4. $mask = 210;
  5. $binary = strrev(decbin($mask));
  6.  
  7. for ($i = 0; $i < strlen($binary); $i++)
  8. {
  9. if ($binary[$i] === '1') $expected[] = ($i + 1);
  10. }
  11.  
  12. print_r($expected);
  13. ?>
Success #stdin #stdout 0.04s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 2
    [1] => 5
    [2] => 7
    [3] => 8
)