3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $bitMask = 5; $bitMask = str_split(strrev((string)decbin((int)$bitMask))); $splited = array(); foreach($bitMask as $pos => $bit) { if (0 != $bit) { $splited[] = /* pow(2, $pos); */ (1 << $pos); } } var_dump($splited);
Output for 5.0.0 - 7.1.0
array(2) { [0]=> int(1) [1]=> int(4) }
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/gT2oe on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/gT2oe on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/gT2oe on line 5