3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isPrimeNumber($num) { $isPrime = 1; for ($i = 2; $i <= ($num/2); $i++) { if ($num % $i == 0){ $isPrime = 0; break; } } return ($isPrime==1 || $num==2)? 1 : 0; } function generateRightTriangle( $rows ) { define("START",2); for ($i = 1, $count = START; $i <= $rows; $i++) { for ($j = 1; $j <= $i; $j++) { while( !isPrimeNumber($count) ){ $count++; } printf(" %-2d", $count); $count++; } printf("\n"); } return true; } if (!generateRightTriangle(5)) { trigger_error("An error has occurred!"); }
Output for git.master, git.master_jit, rfc.property-hooks
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47

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:
35.3 ms | 401 KiB | 8 Q