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!"); }

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.0140.00416.37
8.3.50.0120.01017.48
8.3.40.0150.00618.54
8.3.30.0090.00618.77
8.3.20.0060.00320.69
8.3.10.0080.00019.20
8.3.00.0040.00421.90
8.2.180.0070.01025.92
8.2.170.0140.00022.96
8.2.160.0070.00720.33
8.2.150.0030.00624.18
8.2.140.0000.00724.66
8.2.130.0040.00426.16
8.2.120.0080.00026.16
8.2.110.0030.00722.26
8.2.100.0040.00817.78
8.2.90.0030.00622.16
8.2.80.0030.00517.97
8.2.70.0080.00017.92
8.2.60.0060.00318.22
8.2.50.0030.00518.10
8.2.40.0060.00319.38
8.2.30.0040.00419.30
8.2.20.0000.00718.00
8.2.10.0000.00719.07
8.2.00.0000.00919.64
8.1.280.0070.00725.92
8.1.270.0080.00320.08
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00022.50
8.1.230.0070.00420.85
8.1.220.0050.00317.75
8.1.210.0040.00418.79
8.1.200.0060.00717.11
8.1.190.0000.00817.22
8.1.180.0000.00918.10
8.1.170.0000.00818.65
8.1.160.0020.00518.92
8.1.150.0070.00018.80
8.1.140.0050.00318.84
8.1.130.0000.00720.14
8.1.120.0000.00917.42
8.1.110.0000.00817.52
8.1.100.0030.00517.52
8.1.90.0030.00517.42
8.1.80.0040.00417.36
8.1.70.0040.00417.52
8.1.60.0050.00217.50
8.1.50.0080.00017.58
8.1.40.0100.00017.56
8.1.30.0000.00817.55
8.1.20.0000.00917.71
8.1.10.0030.00517.54
8.1.00.0000.00717.46
8.0.300.0030.00619.86
8.0.290.0080.00016.63
8.0.280.0070.00018.46
8.0.270.0050.00317.20
8.0.260.0000.00718.49
8.0.250.0030.00316.86
8.0.240.0060.00317.01
8.0.230.0040.00416.85
8.0.220.0000.00716.96
8.0.210.0070.00016.89
8.0.200.0000.00616.97
8.0.190.0070.00017.00
8.0.180.0000.00716.86
8.0.170.0040.00416.85
8.0.160.0090.00016.95
8.0.150.0050.00316.75
8.0.140.0070.00016.77
8.0.130.0000.00613.34
8.0.120.0000.00716.75
8.0.110.0000.00716.92
8.0.100.0050.00216.79
8.0.90.0040.00416.74
8.0.80.0060.00916.87
8.0.70.0000.00816.81
8.0.60.0030.00516.79
8.0.50.0040.00416.78
8.0.30.0130.01017.08
8.0.20.0090.01117.25
8.0.10.0000.00716.87
8.0.00.0070.01316.78
7.4.330.0040.00015.55
7.4.320.0040.00416.56
7.4.300.0030.00316.54
7.4.290.0070.00016.55
7.4.280.0040.00416.60
7.4.270.0030.00316.68
7.4.260.0000.00716.62
7.4.250.0050.00216.50
7.4.240.0000.00816.62
7.4.230.0030.00316.51
7.4.220.0040.00416.60
7.4.210.0070.00816.54
7.4.200.0000.00716.61
7.4.160.0120.00416.60
7.4.140.0090.00817.86
7.4.130.0060.01216.51
7.4.120.0120.00916.57
7.4.110.0090.00816.36
7.4.100.0090.00816.39
7.4.90.0090.00916.68
7.4.80.0060.01019.39
7.4.70.0110.00716.49
7.4.60.0100.00716.48
7.4.50.0110.00416.46
7.4.40.0150.00516.50
7.4.00.0110.00415.04
7.3.330.0030.00313.20
7.3.320.0050.00013.19
7.3.310.0040.00416.19
7.3.300.0040.00416.42
7.3.290.0080.00016.38
7.3.280.0070.01016.34
7.3.260.0110.00816.43
7.3.230.0100.00716.36
7.3.210.0030.01316.68
7.3.200.0120.00616.24
7.3.190.0080.00816.47
7.3.180.0160.00816.50
7.3.170.0160.00016.30
7.3.160.0090.00916.70
7.3.50.0090.00814.86
7.3.40.0100.01114.79
7.3.30.0080.00714.70
7.3.20.0100.00414.83
7.3.10.0130.01015.02
7.3.00.0110.00414.80
7.2.330.0120.00616.68
7.2.320.0120.00716.69
7.2.310.0120.00616.38
7.2.300.0120.01216.75
7.2.290.0040.01316.64
7.2.180.0120.00914.92
7.2.170.0120.00914.99
7.2.160.0110.00215.07
7.2.150.0140.00315.14
7.2.140.0190.00815.18
7.2.130.0170.00615.02
7.2.120.0170.00315.02
7.2.110.0080.01115.03
7.2.100.0080.00615.13
7.2.90.0090.01115.14
7.2.80.0080.00815.14
7.2.70.0100.00515.27
7.2.60.0170.00815.08
7.2.50.0170.00715.07
7.2.40.0070.00715.07
7.2.30.0120.00715.18
7.2.20.0180.00815.15
7.2.10.0500.01215.20
7.2.00.0100.00515.10
7.1.280.0120.00713.88
7.1.270.0460.00614.00
7.1.260.0180.00213.91
7.1.250.0090.00514.05

preferences:
64.85 ms | 401 KiB | 5 Q