3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $bitMask = 5; $bitMask = str_split(strrev((string)(int)$bitMask)); $splited = array(); foreach($bitMask as $pos => $bit) { if (0 != $bit) { $splited[] = pow(2, $pos); //(1 << ($pos - 1)) } } var_dump($splited);
Output for 5.0.0 - 7.1.0
array(1) { [0]=> int(1) }
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/ksM89 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/ksM89 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/ksM89 on line 5