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( $num ) { for ($i = 1, $rows = $num, $count = 2; $i <= $rows; $i++) { /* Print spaces in decreasing order of row */ for($j=$i; $j<$rows; $j++) { printf("%s"," "); } for ($j = 1; $j <= $i; $j++) { while( !isPrimeNumber($count) ){ $count++; } if ($i == 1) { printf(" %d",$count); } else if ($i == 2) { printf(" %-d",$count); } else if ($i == 3) { if ($count == 7) { printf(" %-d",$count); } else { printf(" %-2d",$count); } } else { printf(" %-d", $count); } $count++; } printf("\n"); } return true; } if (!generateRightTriangle(5)) { trigger_error("An error has occurred!"); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0110.00718.43
8.3.50.0110.00717.29
8.3.40.0140.00018.58
8.3.30.0120.00318.71
8.3.20.0000.00822.48
8.3.10.0000.00820.90
8.3.00.0000.00821.79
8.2.180.0150.00625.92
8.2.170.0090.00622.96
8.2.160.0090.00620.38
8.2.150.0050.00325.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00820.69
8.2.110.0070.00321.04
8.2.100.0040.00819.63
8.2.90.0030.00517.97
8.2.80.0050.00317.97
8.2.70.0080.00018.03
8.2.60.0040.00418.22
8.2.50.0000.00818.10
8.2.40.0040.00419.39
8.2.30.0000.00719.23
8.2.20.0030.00518.13
8.2.10.0030.00519.07
8.2.00.0040.00419.42
8.1.280.0160.00925.92
8.1.270.0080.00022.09
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00022.10
8.1.230.0030.00720.87
8.1.220.0000.00817.77
8.1.210.0040.00418.97
8.1.200.0030.00617.35
8.1.190.0000.00817.23
8.1.180.0000.00918.10
8.1.170.0040.00418.45
8.1.160.0000.00818.89
8.1.150.0040.00418.92
8.1.140.0000.00718.84
8.1.130.0080.00020.20
8.1.120.0040.00417.52
8.1.110.0080.00017.47
8.1.100.0040.00417.38
8.1.90.0030.00717.36
8.1.80.0090.00017.46
8.1.70.0060.00317.38
8.1.60.0030.00517.58
8.1.50.0030.00517.50
8.1.40.0090.00017.50
8.1.30.0000.00817.74
8.1.20.0040.00417.56
8.1.10.0070.00017.53
8.1.00.0030.00517.35
8.0.300.0020.00520.04
8.0.290.0000.01016.75
8.0.280.0080.00018.39
8.0.270.0030.00317.27
8.0.260.0000.00618.46
8.0.250.0070.00016.85
8.0.240.0030.00317.01
8.0.230.0000.00716.96
8.0.220.0030.00316.80
8.0.210.0070.00016.93
8.0.200.0030.00317.01
8.0.190.0000.00716.88
8.0.180.0080.00016.99
8.0.170.0030.00717.01
8.0.160.0040.00416.80
8.0.150.0040.00416.80
8.0.140.0050.00316.86
8.0.130.0080.00013.42
8.0.120.0040.00416.89
8.0.110.0030.00516.88
8.0.100.0000.00816.77
8.0.90.0050.00216.95
8.0.80.0110.01016.88
8.0.70.0070.00016.97
8.0.60.0080.00016.97
8.0.50.0040.00416.89
8.0.30.0060.01617.19
8.0.20.0200.00617.05
8.0.10.0000.00716.91
8.0.00.0070.01016.82
7.4.330.0000.00415.55
7.4.320.0060.00016.44
7.4.300.0050.00216.59
7.4.290.0040.00416.62
7.4.280.0050.00316.61
7.4.270.0000.00716.62
7.4.260.0030.00316.53
7.4.250.0030.00316.51
7.4.240.0000.00716.46
7.4.230.0070.00016.38
7.4.220.0070.00316.64
7.4.210.0090.00916.54
7.4.200.0000.00716.47
7.4.160.0070.00916.58
7.4.140.0060.01217.86
7.4.130.0130.00316.33
7.4.120.0090.00916.60
7.4.110.0060.01616.63
7.4.100.0030.01416.36
7.4.90.0160.00316.49
7.4.80.0090.01219.39
7.4.70.0070.01016.45
7.4.60.0060.01316.68
7.4.50.0030.01016.43
7.4.40.0110.00516.65
7.4.00.0070.00714.83
7.3.330.0080.00013.41
7.3.320.0030.00313.46
7.3.310.0000.00716.29
7.3.300.0000.00716.39
7.3.290.0000.00716.22
7.3.280.0080.00816.39
7.3.260.0100.01016.49
7.3.240.0060.01116.60
7.3.230.0080.00816.49
7.3.210.0030.01316.25
7.3.200.0070.01116.66
7.3.190.0130.00316.64
7.3.180.0100.00616.53
7.3.170.0060.01016.41
7.3.160.0090.01516.48
7.3.120.0070.01015.13
7.3.110.0080.01114.84
7.3.100.0030.01114.80
7.3.90.0060.00614.57
7.3.80.0000.01115.07
7.3.70.0030.01014.86
7.3.60.0030.00914.95
7.3.50.0050.01014.88
7.3.40.0080.00914.90
7.3.30.0040.01014.94
7.3.20.0070.00716.62
7.3.10.0080.00716.63
7.3.00.0070.00916.63
7.2.330.0080.00816.70
7.2.320.0100.01016.51
7.2.310.0100.00616.96
7.2.300.0030.01516.46
7.2.290.0060.01216.55
7.2.240.0160.00714.98
7.2.230.0070.01014.76
7.2.220.0000.01215.20
7.2.210.0070.00715.11
7.2.200.0100.00315.00
7.2.190.0040.01115.13
7.2.180.0050.01615.10
7.2.170.0050.01015.12
7.2.160.0070.00415.10
7.2.150.0090.00516.98
7.2.140.0070.00616.91
7.2.130.0100.00616.69
7.2.120.0080.01216.84
7.2.110.0070.01016.95
7.2.100.0140.00516.87
7.2.90.0100.00716.94
7.2.80.0080.01416.83
7.2.70.0080.01117.00
7.2.60.0030.01216.98
7.2.50.0080.00816.83
7.2.40.0050.00916.87
7.2.30.0110.00317.06
7.2.20.0120.00516.94
7.2.10.0130.00716.88
7.2.00.0080.00417.00
7.1.330.0000.01815.84
7.1.320.0100.00615.73
7.1.310.0040.01215.68
7.1.300.0120.00015.96
7.1.290.0090.00615.79
7.1.280.0110.00315.66
7.1.270.0050.00715.82
7.1.260.0070.00515.71
7.1.250.0080.00515.79

preferences:
57.95 ms | 401 KiB | 5 Q