3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class C { function generatePrimes($n) { $this->primes = [2]; for ($i = 3; $i < $n; $i += 2) { foreach ($this->primes as $prime) { if ($i % $prime == 0) continue 2; } $this->primes[] = $i; } } } $c = new C(); $c->generatePrimes(100000);
Output for 5.4.0, 5.4.3, 5.4.5 - 5.4.13, 5.4.15, 5.4.17 - 5.4.21, 5.4.23, 5.4.25 - 7.1.0
Output for 5.4.1 - 5.4.2, 5.4.4, 5.4.14, 5.4.16, 5.4.22, 5.4.24

Process exited with code 137.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/KI9ZC on line 5
Process exited with code 255.