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("END", 47); for ($i = 1, $count = END; $i <= $rows; $i++) { for ($j = 5; $j >= $i; $j--) { while( !isPrimeNumber($count) ){ $count--; } if ($count == 3) { 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.0150.00018.43
8.3.50.0140.00516.36
8.3.40.0040.01118.85
8.3.30.0040.01118.51
8.3.20.0060.00320.47
8.3.10.0080.00019.16
8.3.00.0050.00321.82
8.2.180.0110.00425.92
8.2.170.0080.01318.83
8.2.160.0100.01022.96
8.2.150.0000.00825.66
8.2.140.0050.00324.66
8.2.130.0030.00626.16
8.2.120.0080.00021.12
8.2.110.0100.00022.26
8.2.100.0080.00417.84
8.2.90.0000.00817.91
8.2.80.0000.00817.97
8.2.70.0060.00317.80
8.2.60.0090.00018.16
8.2.50.0030.00518.10
8.2.40.0040.00419.48
8.2.30.0040.00419.35
8.2.20.0000.00818.09
8.2.10.0030.00718.96
8.2.00.0030.00619.44
8.1.280.0110.00425.92
8.1.270.0070.00320.39
8.1.260.0120.00326.35
8.1.250.0040.00428.09
8.1.240.0000.00923.95
8.1.230.0070.00422.63
8.1.220.0080.00017.74
8.1.210.0050.00318.77
8.1.200.0090.00017.35
8.1.190.0040.00417.22
8.1.180.0040.00418.10
8.1.170.0040.00418.55
8.1.160.0040.00419.00
8.1.150.0000.00718.99
8.1.140.0000.00818.98
8.1.130.0070.00020.21
8.1.120.0080.00317.56
8.1.110.0030.00617.48
8.1.100.0070.00017.51
8.1.90.0030.00517.54
8.1.80.0040.00417.38
8.1.70.0030.00317.44
8.1.60.0030.00617.56
8.1.50.0050.00217.49
8.1.40.0030.00617.54
8.1.30.0050.00317.66
8.1.20.0000.00817.54
8.1.10.0030.00617.55
8.1.00.0000.00717.53
8.0.300.0070.00319.32
8.0.290.0050.00316.88
8.0.280.0070.00018.39
8.0.270.0050.00317.21
8.0.260.0030.00318.42
8.0.250.0030.00317.00
8.0.240.0000.00616.92
8.0.230.0030.00317.02
8.0.220.0000.00716.77
8.0.210.0040.00416.80
8.0.200.0060.00017.05
8.0.190.0000.00816.99
8.0.180.0030.00317.04
8.0.170.0030.00616.96
8.0.160.0000.00716.89
8.0.150.0040.00416.88
8.0.140.0000.00716.91
8.0.130.0060.00313.36
8.0.120.0050.00316.93
8.0.110.0080.00016.94
8.0.100.0040.00416.89
8.0.90.0000.00816.89
8.0.80.0090.01116.90
8.0.70.0050.00216.92
8.0.60.0000.00716.92
8.0.50.0020.00516.92
8.0.30.0100.01017.15
8.0.20.0100.01217.01
8.0.10.0070.00016.83
8.0.00.0090.01216.78
7.4.330.0000.00515.55
7.4.320.0000.00716.64
7.4.300.0060.00316.69
7.4.290.0040.00416.63
7.4.280.0040.00416.54
7.4.270.0060.00016.66
7.4.260.0030.00316.70
7.4.250.0070.00016.51
7.4.240.0030.00416.63
7.4.230.0070.00016.75
7.4.220.0000.00816.41
7.4.210.0050.01016.61
7.4.200.0050.00316.65
7.4.160.0080.00916.50
7.4.140.0060.01117.86
7.4.130.0120.01216.53
7.4.120.0110.00616.52
7.4.110.0100.00716.51
7.4.100.0070.01016.62
7.4.90.0200.00316.50
7.4.80.0060.01519.39
7.4.70.0130.00616.51
7.4.60.0030.01216.45
7.4.50.0070.01016.30
7.4.40.0130.00316.50
7.4.10.0130.00715.11
7.4.00.0040.01215.11
7.3.330.0000.00513.42
7.3.320.0000.00513.39
7.3.310.0070.00016.41
7.3.300.0030.00316.23
7.3.290.0100.00316.34
7.3.280.0060.01616.36
7.3.260.0100.01016.60
7.3.240.0070.01116.58
7.3.230.0130.00316.57
7.3.210.0070.01016.30
7.3.200.0110.00616.43
7.3.190.0090.00916.43
7.3.180.0060.01216.49
7.3.170.0030.01316.39
7.3.160.0070.01416.34
7.3.130.0040.01114.98
7.3.120.0040.01414.93
7.3.110.0050.01214.94
7.3.100.0030.01314.76
7.3.90.0060.01014.97
7.3.80.0070.00814.86
7.3.70.0060.00814.85
7.3.60.0040.01014.78
7.3.50.0070.01014.80
7.3.40.0060.00814.81
7.3.30.0090.00814.81
7.3.20.0080.00716.30
7.3.10.0120.00616.35
7.3.00.0040.00716.23
7.2.330.0150.01016.40
7.2.320.0130.00616.84
7.2.310.0120.00616.90
7.2.300.0030.01616.52
7.2.290.0140.00316.45
7.2.260.0120.00614.78
7.2.250.0070.01114.93
7.2.240.0060.01114.99
7.2.230.0060.00615.16
7.2.220.0060.01114.93
7.2.210.0040.01015.16
7.2.200.0070.00414.97
7.2.190.0060.01114.94
7.2.180.0070.00815.01
7.2.170.0080.00615.10
7.2.160.0090.00515.10
7.2.150.0110.00716.36
7.2.140.0100.01016.40
7.2.130.0060.00716.31
7.2.120.0060.01116.47
7.2.110.0080.00816.43
7.2.100.0080.00716.50
7.2.90.0090.00716.44
7.2.80.0080.00716.46
7.2.70.0050.01116.49
7.2.60.0130.00816.44
7.2.50.0090.01016.45
7.2.40.0080.01016.45
7.2.30.0080.00716.39
7.2.20.0090.00616.38
7.2.10.0110.00716.51
7.2.00.0050.00916.41
7.1.330.0050.01015.86
7.1.320.0040.00815.89
7.1.310.0040.01015.73
7.1.300.0070.01115.75
7.1.290.0040.01215.81
7.1.280.0080.00815.44
7.1.270.0080.00715.41
7.1.260.0200.00815.43
7.1.250.0050.00915.30
7.1.240.0090.00315.83
7.1.230.0040.01115.67
7.1.220.0030.01316.01
7.1.210.0040.00715.61
7.1.200.0000.00915.71
7.1.190.0110.00415.86
7.1.180.0070.00715.53
7.1.170.0130.00315.94
7.1.160.0120.00315.73
7.1.150.0060.00615.82
7.1.140.0090.00615.84
7.1.130.0090.00315.79
7.1.120.0040.00716.00
7.1.110.0120.00315.89
7.1.100.0070.00716.02
7.1.90.0030.00915.81
7.1.80.0080.00315.75
7.1.70.0040.00415.93
7.1.60.0000.01515.57
7.1.50.0090.00616.00
7.1.40.0130.00315.91
7.1.30.0070.00715.93
7.1.20.0030.01315.89
7.1.10.0040.01115.91
7.1.00.0060.00615.90

preferences:
64.71 ms | 401 KiB | 5 Q