3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function isEven(int $num): bool { if ($num % 2 == 0) { return true; } else { return false; } } function pattern(int $num): void { for ($i = $num; $i > 1;) { if (isEven($i)) { $i = $i / 2; echo $i . " "; } else if (!isEven($i)) { $i = $i * 3 + 1; echo $i . " "; } } } $num = pow(2, 32); pattern($num);
based on 7th9Q
Output for 7.1.25 - 7.3.1
2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4194304 2097152 1048576 524288 262144 131072 65536 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1