3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $n = 80000; $start = microtime(true); $arr = array(); if ($n >= 2) $arr[] = 2; for ($i = 3; $i<=$n; $i+=2) { $arr[] = $i; } foreach ($arr as $key=>$row) { foreach($arr as $key2=>$row2) { if ($key2 > $key && ($row2 % $row) === 0) { unset($arr[$key2]); } } } $arr = array_values($arr); echo '<pre>'; echo array_sum($arr), PHP_EOL; echo (microtime(true)-$start);
Output for 5.3.7 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0

Process exited with code 137.