3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function is_prime($num) { $n = $num - 1; while ($n > 1) { if (is_int($num / $n)) { return false; } $n--; } return true; } header('Content-type: text/plain'); foreach (range(1,10) as $num) { if (is_prime($num)) { echo "$num is prime\n"; } else { echo "$num is not prime\n"; } }
Output for 4.3.0 - 5.6.21, hhvm-3.12.0, 7.0.0 - 7.1.0
1 is prime 2 is prime 3 is prime 4 is not prime 5 is prime 6 is not prime 7 is prime 8 is not prime 9 is not prime 10 is not prime
Output for hhvm-3.10.0

Process exited with code 153.