3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Primes</title> </head> <body> <p id="line">Prime numbers less than 100: </p> </body> </html> <?php /** * Created by PhpStorm. * User: lilit * Date: 7/9/17 * Time: 8:44 PM */ function checkPrime() { for ($i = 2; $i < 100; $i++) { $primeTrue = true; for ($j = 2; $j <= sqrt($i); $j++) { if ($i % $j === 0) { $primeTrue = false; } } if ($primeTrue) { echo $i.' '; } } } checkPrime(); ?>
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.8
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Primes</title> </head> <body> <p id="line">Prime numbers less than 100: </p> </body> </html> 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97