3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $primes = array(); $found = 0; for ($x = 2; $x <= 10000; $x++) { $xIsPrime = TRUE; $sqrtX = sqrt($x); foreach ($primes as $prime) if ($prime > $sqrtX || ((!($x % $prime)) && (!$xIsPrime = FALSE))) break; if ($xIsPrime) $found++; } echo $found;
based on m2nf0
Output for 4.3.0 - 7.1.0
9999