3v4l.org

run code in 300+ PHP versions simultaneously
<?php { // The n-th prime we're aiming for $n = 444; // The first prime is the only even one $primes = array(1 => 2); // Loop counters $c = 1; $p = 3; $cnt =0; while (true) { // Check if $p is prime $prime = true; $sqrt = sqrt($p); for ($i = 1; $i < $c && $primes[$i] <= $sqrt; $i++) { if ($p % $primes[$i] == 0) { $prime = false; break; } } // Record $p if prime if ($prime) { $primes[++$c] = $p; $hexchr = base_convert($p, 10, 16); if (strpos($hexchr,'beef') !== false) { $beefprime[++$cnt]=$p; echo "$p HEX IS $hexchr\n"; } if ($cnt == $n) { break; } } // Next $p to check $p += 2; } echo "444th prime number is $beefprime[$n]"; }
Output for git.master, git.master_jit
179951 HEX IS 2beef 507631 HEX IS 7beef 782071 HEX IS beef7 1162991 HEX IS 11beef 3260143 HEX IS 31beef
Process exited with code 137.
Output for rfc.property-hooks
179951 HEX IS 2beef 507631 HEX IS 7beef 782071 HEX IS beef7 1162991 HEX IS 11beef 3260143 HEX IS 31beef 3653359 HEX IS 37beef 3915503 HEX IS 3bbeef
Process exited with code 137.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.42 ms | 401 KiB | 8 Q