3v4l.org

run code in 300+ PHP versions simultaneously
<?php // user input of years - note it must be numeric $ar = array(1944, 1674, 3021); // find max year of the input for 'dynamic' approach // note the unpacking of the array is not needed I do not think // but does work - check performance $maxCentury = max(...$ar); // round max century to -3 (closest 1000) $roundedCentury = round($maxCentury, -3); foreach($ar as $year): foreach(range(0, $maxCentury, 1000) as $century): if(round($year, -3) == $century): ?> <li> <?= $century; ?> <ul> <?= $year; ?> </ul> </li> <?php endif; endforeach; endforeach;

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.0090.00616.63
8.3.50.0040.01119.80
8.3.40.0090.01318.71
8.3.30.0070.00718.70
8.3.20.0000.00818.98
8.3.10.0040.00423.61
8.3.00.0080.00020.96
8.2.180.0100.00716.32
8.2.170.0040.01122.96
8.2.160.0180.00020.52
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0050.00321.13
8.2.120.0050.00326.35
8.2.110.0080.00022.39
8.2.100.0090.00317.72
8.2.90.0080.00019.09
8.2.80.0000.00817.97
8.2.70.0000.00817.93
8.2.60.0080.00018.03
8.2.50.0040.00418.10
8.2.40.0000.00820.62
8.2.30.0000.00719.38
8.2.20.0000.00818.13
8.2.10.0040.00418.07
8.2.00.0040.00417.82
8.1.280.0140.00725.92
8.1.270.0040.00422.21
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00024.05
8.1.230.0080.00319.29
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0030.00717.48
8.1.190.0030.00617.35
8.1.180.0030.00618.10
8.1.170.0040.00418.88
8.1.160.0040.00418.87
8.1.150.0000.00720.25
8.1.140.0040.00419.59
8.1.130.0070.00017.65
8.1.120.0080.00017.53
8.1.110.0040.00417.56
8.1.100.0060.00317.43
8.1.90.0000.00817.54
8.1.80.0040.00417.47
8.1.70.0030.00317.42
8.1.60.0000.00817.54
8.1.50.0000.00917.46
8.1.40.0000.00817.59
8.1.30.0000.00817.55
8.1.20.0000.00817.74
8.1.10.0050.00317.48
8.1.00.0060.00317.56
8.0.300.0070.00019.60
8.0.290.0090.00016.75
8.0.280.0040.00418.50
8.0.270.0000.00817.32
8.0.260.0030.00317.21
8.0.250.0090.00017.03
8.0.240.0000.00716.96
8.0.230.0040.00316.92
8.0.220.0040.00416.88
8.0.210.0070.00016.87
8.0.200.0000.00816.91
8.0.190.0040.00416.95
8.0.180.0000.00716.83
8.0.170.0040.00416.88
8.0.160.0000.00817.02
8.0.150.0050.00316.91
8.0.140.0040.00416.91
8.0.130.0070.00013.42
8.0.120.0000.00816.96
8.0.110.0000.00716.99
8.0.100.0030.00516.91
8.0.90.0000.00816.84
8.0.80.0030.01216.96
8.0.70.0070.00016.83
8.0.60.0040.00417.00
8.0.50.0080.00016.85
8.0.30.0140.00917.14
8.0.20.0150.00617.40
8.0.10.0040.00416.96
8.0.00.0110.01116.75
7.4.330.0060.00015.55
7.4.320.0060.00016.49
7.4.300.0070.00016.71
7.4.290.0030.00316.49
7.4.280.0000.00816.47
7.4.270.0000.00716.68
7.4.260.0080.00016.60
7.4.250.0000.00716.56
7.4.240.0030.00316.72
7.4.230.0030.00316.75
7.4.220.0120.00616.62
7.4.210.0070.00816.52
7.4.200.0030.00316.67
7.4.160.0090.00716.63
7.4.150.0060.01217.40
7.4.140.0090.01117.86
7.4.130.0090.00816.63
7.4.120.0100.00916.53
7.4.110.0110.00816.52
7.4.100.0130.00716.55
7.4.90.0090.00916.73
7.4.80.0080.00919.39
7.4.70.0140.00316.67
7.4.60.0030.01316.56
7.4.50.0060.00616.56
7.4.40.0090.00916.69
7.4.30.0130.00916.55
7.4.10.0000.01815.16
7.4.00.0090.00815.00
7.3.330.0040.00413.16
7.3.320.0000.00513.18
7.3.310.0000.00616.19
7.3.300.0000.00716.22
7.3.290.0030.00616.23
7.3.280.0080.01016.32
7.3.270.0130.01017.40
7.3.260.0120.00516.62
7.3.250.0090.00816.38
7.3.240.0080.01116.40
7.3.230.0080.01116.39
7.3.210.0080.00916.29
7.3.200.0110.00716.42
7.3.190.0150.00616.65
7.3.180.0060.00916.71
7.3.170.0060.00916.64
7.3.160.0040.01316.42
7.3.130.0070.00714.70
7.3.120.0090.00814.88
7.3.110.0110.00714.80
7.3.100.0040.01014.83
7.3.90.0030.01114.90
7.3.80.0100.00714.95
7.3.70.0050.01014.65
7.3.60.0060.00814.54
7.3.50.0050.00814.78
7.3.40.0030.00814.85
7.3.30.0070.00714.71
7.3.20.0080.00516.63
7.3.10.0090.00716.83
7.3.00.0020.01516.68
7.2.330.0110.00616.64
7.2.320.0110.00616.83
7.2.310.0150.00316.75
7.2.300.0120.00616.49
7.2.290.0080.00816.84
7.2.260.0070.00715.04
7.2.250.0050.01014.98
7.2.240.0050.01314.82
7.2.230.0090.00515.03
7.2.220.0030.01014.91
7.2.210.0050.00914.94
7.2.200.0090.00514.92
7.2.190.0020.01214.88
7.2.180.0030.01114.82
7.2.170.0030.01015.00
7.2.160.0040.01115.18
7.2.150.0060.00616.87
7.2.140.0030.01317.00
7.2.130.0000.01416.83
7.2.120.0030.00917.02
7.2.110.0090.00917.02
7.2.100.0000.01316.91
7.2.90.0000.01216.89
7.2.80.0040.01416.98
7.2.70.0060.00916.84
7.2.60.0100.00516.91
7.2.50.0050.00917.09
7.2.40.0030.01017.16
7.2.30.0060.00316.92
7.2.20.0040.01116.84
7.2.10.0070.00316.93
7.2.00.0050.00918.30
7.1.330.0070.00815.83
7.1.320.0050.00915.90
7.1.310.0050.00615.96
7.1.300.0040.00615.69
7.1.290.0050.01015.75
7.1.280.0070.00315.86
7.1.270.0020.01115.74
7.1.260.0050.01115.69
7.1.250.0070.00716.04
7.1.240.0030.01315.80
7.1.230.0070.00315.86
7.1.220.0030.01015.90
7.1.210.0070.00715.72
7.1.200.0080.00515.59
7.1.190.0060.00615.79
7.1.180.0040.01115.96
7.1.170.0060.00615.71
7.1.160.0000.01115.70
7.1.150.0080.00015.42
7.1.140.0070.00715.82
7.1.130.0000.00915.86
7.1.120.0000.01715.98
7.1.110.0030.00615.86
7.1.100.0090.00615.93
7.1.90.0000.01415.93
7.1.80.0070.01015.81
7.1.70.3030.00616.60
7.1.60.0310.00216.72
7.1.50.0280.00716.70
7.1.40.0280.00816.83
7.1.30.0330.00316.69
7.1.20.0400.00616.69
7.1.10.0280.00716.69
7.1.00.0170.01116.77
7.0.330.0100.00315.47
7.0.320.0000.00815.40
7.0.310.0060.00615.42
7.0.300.0040.00415.48
7.0.290.0040.00715.34
7.0.280.0080.00415.15
7.0.270.0000.00915.47
7.0.260.0060.00315.43
7.0.250.0000.01015.60
7.0.240.0060.00915.53
7.0.230.0040.01115.48
7.0.220.0120.00315.46
7.0.210.0100.00315.25
7.0.200.0250.00516.56
7.0.190.0260.00716.55
7.0.180.0270.00616.53
7.0.170.0230.00716.60
7.0.160.0290.00616.52
7.0.150.0250.00816.52
7.0.140.0240.00816.50
7.0.130.0220.00816.48
7.0.120.0230.00616.64
7.0.110.0220.00816.59
7.0.100.0330.00416.60
7.0.90.0370.00816.52
7.0.80.0300.00716.50
7.0.70.0340.00716.53
7.0.60.0230.00716.61
7.0.50.0200.00916.48
7.0.40.0050.00815.63
7.0.30.0060.00815.46
7.0.20.0080.00315.48
7.0.10.0070.00815.49
7.0.00.0050.01015.52
5.6.400.0060.01214.54
5.6.390.0150.00014.21
5.6.380.0070.00714.54
5.6.370.0000.01414.44
5.6.360.0030.00714.32
5.6.350.0030.01013.85
5.6.340.0070.00714.66
5.6.330.0000.01114.20
5.6.320.0100.00314.63
5.6.310.0070.00314.32
5.6.300.0080.02617.60
5.6.290.0120.02117.50
5.6.280.0100.03217.52
5.6.270.0110.02517.68
5.6.260.0070.02717.79
5.6.250.0110.01917.75
5.6.240.0070.03217.67
5.6.230.0100.04117.44
5.6.220.0140.02117.68
5.6.210.0030.02717.55
5.6.200.0050.02717.63
5.6.190.0070.02417.63
5.6.180.0100.02217.57
5.6.170.0060.02717.46
5.6.160.0130.03117.74
5.6.150.0100.02317.56
5.6.140.0110.03017.66
5.6.130.0160.03117.61
5.6.120.0060.02417.63
5.6.110.0100.03617.62
5.6.100.0160.03917.51
5.6.90.0100.02417.52
5.6.80.0100.02417.20
5.6.70.0100.02817.26
5.6.60.0070.04017.37
5.6.50.0080.02517.27
5.6.40.0080.02517.20
5.6.30.0020.03617.34
5.6.20.0050.03017.34
5.6.10.0150.02617.19
5.6.00.0110.02817.23

preferences:
58.4 ms | 401 KiB | 5 Q