3v4l.org

run code in 300+ PHP versions simultaneously
<?php $births = [1997, 1997, 1997, 1998, 1999]; $deaths = [1998, 1999]; $years = []; $min = PHP_INT_MAX; $max = -1; foreach ($births as $year) { if (!isset($years[$year])) $years[$year] = 0; $min = min($min, $year); $max = max($max, $year); $years[$year]++; } foreach ($deaths as $year) { if (!isset($years[$year])) $years[$year] = 0; $min = min($min, $year); $max = max($max, $year); $years[$year]--; } $acc = 0; $maxYear = null; $maxYearValue = null; for ($i = $min; $i <= $max; $i++) { if (!isset($years[$i])) { continue; } $acc += $years[$i]; if ($acc > $maxYearValue) { $maxYear = $i; $maxYearValue = $acc; } } var_dump($maxYear, $maxYearValue);

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.70.0070.01118.30
8.3.60.0070.00716.50
8.3.50.0140.00016.64
8.3.40.0090.00618.80
8.3.30.0110.01118.66
8.3.20.0080.00021.02
8.3.10.0050.00320.21
8.3.00.0000.00820.91
8.2.190.0070.00716.58
8.2.180.0070.01518.36
8.2.170.0120.00622.96
8.2.160.0070.01122.19
8.2.150.0000.01024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00426.16
8.2.110.0070.01422.23
8.2.100.0110.00417.84
8.2.90.0040.00417.75
8.2.80.0000.01018.73
8.2.70.0040.00417.50
8.2.60.0060.00317.50
8.2.50.0030.00618.05
8.2.40.0070.00018.28
8.2.30.0040.00419.50
8.2.20.0040.00418.20
8.2.10.0040.00421.00
8.2.00.0000.00719.21
8.1.280.0110.01125.92
8.1.270.0090.00022.14
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00618.61
8.1.230.0090.00317.82
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.35
8.1.180.0030.00618.10
8.1.170.0030.00617.62
8.1.160.0080.00019.03
8.1.150.0050.00318.94
8.1.140.0000.00718.95
8.1.130.0030.00320.14
8.1.120.0000.00717.37
8.1.110.0040.00417.43
8.1.100.0030.00517.45
8.1.90.0000.00717.36
8.1.80.0030.00517.47
8.1.70.0030.00317.34
8.1.60.0040.00417.48
8.1.50.0040.00417.54
8.1.40.0030.00517.48
8.1.30.0040.00417.49
8.1.20.0030.00717.67
8.1.10.0040.00417.45
8.1.00.0040.00417.43
8.0.300.0040.00418.87
8.0.290.0000.01016.75
8.0.280.0030.00318.41
8.0.270.0000.00818.02
8.0.260.0040.00419.96
8.0.250.0000.00816.92
8.0.240.0070.00016.90
8.0.230.0000.00716.84
8.0.220.0000.00816.82
8.0.210.0050.00316.79
8.0.200.0000.00817.00
8.0.190.0000.00716.86
8.0.180.0040.00416.78
8.0.170.0060.00616.95
8.0.160.0040.00416.92
8.0.150.0040.00416.79
8.0.140.0000.00716.89
8.0.130.0030.00313.27
8.0.120.0020.00516.88
8.0.110.0050.00216.91
8.0.100.0040.00416.89
8.0.90.0000.00816.88
8.0.80.0110.00516.89
8.0.70.0050.00316.73
8.0.60.0000.00716.69
8.0.50.0000.00716.94
8.0.30.0080.00817.06
8.0.20.0070.01217.19
8.0.10.0000.00817.07
8.0.00.0040.01316.84
7.4.330.0000.00515.55
7.4.320.0040.00416.54
7.4.300.0000.00616.60
7.4.290.0050.00316.60
7.4.280.0000.00816.57
7.4.270.0070.00016.54
7.4.260.0000.00513.20
7.4.250.0070.00016.47
7.4.240.0030.00516.59
7.4.230.0030.00316.73
7.4.220.0030.00316.66
7.4.210.0060.01016.62
7.4.200.0040.00416.36
7.4.130.0140.00916.55
7.4.120.0110.00616.43
7.4.110.0170.00916.43
7.4.100.0100.01016.68
7.4.90.0110.00816.52
7.4.80.0060.01519.39
7.4.70.0120.00916.55
7.4.60.0080.00816.53
7.4.50.0000.01216.26
7.4.40.0070.01016.50
7.4.20.0100.01216.41
7.4.10.0070.01316.39
7.4.00.0130.00616.43
7.3.330.0000.00816.26
7.3.320.0030.00213.28
7.3.310.0030.00316.16
7.3.300.0000.00816.36
7.3.290.0070.00816.31
7.3.280.0110.00416.32
7.3.260.0070.01016.59
7.3.240.0090.00716.48
7.3.230.0100.00616.32
7.3.210.0160.00616.44
7.3.200.0130.00316.67
7.3.190.0090.00916.53
7.3.180.0060.01016.63
7.3.170.0120.00916.50
7.3.160.0060.01016.40
7.3.140.0160.00616.59
7.3.130.0120.00916.36
7.3.120.0090.01716.31
7.3.110.0100.01216.52
7.3.100.0120.00916.28
7.3.90.0040.01316.32
7.3.80.0070.01116.34
7.3.70.0150.00316.37
7.3.60.0100.01016.46
7.3.50.0040.01616.38
7.3.40.0130.01016.38
7.3.30.0090.01216.23
7.3.20.0180.00616.40
7.3.10.0190.01516.44
7.3.00.0200.00016.29
7.2.330.0060.01216.71
7.2.320.0080.00816.75
7.2.310.0090.01216.55
7.2.300.0060.01116.80
7.2.290.0110.01116.84
7.2.270.0060.01616.56
7.2.260.0030.02016.50
7.2.250.0130.00616.70
7.2.240.0150.00916.63
7.2.230.0100.01016.75
7.2.220.0130.00616.80
7.2.210.0060.01216.65
7.2.200.0150.00516.78
7.2.190.0070.01516.71
7.2.180.0130.01316.69
7.2.170.0060.01516.71
7.2.160.0100.01316.67
7.2.150.0150.00916.61
7.2.140.0130.00916.61
7.2.130.0140.01316.70
7.2.120.0120.01216.66
7.2.110.0150.00616.74
7.2.100.0100.01316.59
7.2.90.0130.00716.57
7.2.80.0140.00416.46
7.2.70.0120.01216.59
7.2.60.0070.01316.70
7.2.50.0070.01116.75
7.2.40.0090.00916.64
7.2.30.0100.01216.71
7.2.20.0070.01116.58
7.2.10.0060.01616.62
7.2.00.0070.01416.52

preferences:
32.1 ms | 401 KiB | 5 Q