3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "2022-10-30" => ['▶'], "2022-10-31" => ['▶'], "2022-11-07" => ['▶'], "2022-11-09" => ['▶'] ]; $result = []; foreach ($array as $key => $value) { $ym = substr($key, 0, 7); if (!isset($lookup[$ym]) || $lookup[$ym] < $key) { $result[$key] = $value; if (isset($lookup[$ym])) { unset($result[$lookup[$ym]]); } $lookup[$ym] = $key; } } var_export($result);

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.4.130.0130.00817.85
8.4.120.0090.00822.55
8.4.110.0100.01022.58
8.4.100.0080.00218.59
8.4.90.0140.00718.92
8.4.80.0130.00718.75
8.4.70.0100.01017.76
8.4.60.0110.01018.94
8.4.50.0070.01117.82
8.4.40.0060.01319.61
8.4.30.0040.00418.83
8.4.20.0060.00319.43
8.4.10.0060.00323.91
8.3.260.0140.00716.66
8.3.250.0130.00618.95
8.3.240.0120.00917.18
8.3.230.0130.00616.82
8.3.220.0120.00518.97
8.3.210.0110.00718.38
8.3.200.0050.00416.74
8.3.190.0080.01018.89
8.3.180.0060.00416.72
8.3.170.0000.00817.25
8.3.160.0140.00317.20
8.3.150.0090.00917.12
8.3.140.0110.00416.60
8.3.130.0060.00318.17
8.3.120.0120.00920.78
8.3.110.0090.00016.86
8.3.100.0110.00416.61
8.3.90.0070.00026.77
8.3.80.0090.00016.75
8.3.70.0070.00716.58
8.3.60.0140.00716.75
8.3.50.0040.01118.32
8.3.40.0040.01120.13
8.3.30.0110.00418.54
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0120.00720.33
8.2.280.0110.00722.50
8.2.270.0040.01417.13
8.2.260.0160.00316.44
8.2.250.0080.00018.48
8.2.240.0040.00717.34
8.2.230.0050.00320.94
8.2.220.0040.00424.06
8.2.210.0100.00326.77
8.2.200.0140.00018.00
8.2.190.0040.01116.63
8.2.180.0070.00725.92
8.2.170.0090.00619.14
8.2.160.0070.00722.96
8.2.150.0070.00025.66
8.2.140.0050.00324.66
8.2.130.0090.00026.16
8.2.120.0070.00020.79
8.2.110.0030.00621.98
8.2.100.0070.00317.91
8.2.90.0050.00317.97
8.2.80.0090.00019.20
8.2.70.0080.00017.50
8.2.60.0050.00318.05
8.2.50.0030.00518.07
8.2.40.0040.00418.16
8.2.30.0040.00418.12
8.2.20.0000.00819.36
8.2.10.0040.00418.02
8.2.00.0050.00219.34
8.1.330.0060.00322.12
8.1.320.0120.00816.11
8.1.310.0000.00916.87
8.1.300.0130.00320.04
8.1.290.0060.00330.84
8.1.280.0070.01025.92
8.1.270.0070.00024.66
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0090.00023.93
8.1.230.0060.00621.11
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0090.00017.25
8.1.190.0080.00017.36
8.1.180.0080.00018.10
8.1.170.0050.00318.82
8.1.160.0040.00418.94
8.1.150.0000.00818.59
8.1.140.0040.00417.44
8.1.130.0040.00417.37
8.1.120.0060.00417.44
8.1.110.0060.00617.49
8.1.100.0090.00217.44
8.1.90.0090.00717.39
8.1.80.0120.00417.52
8.1.70.0100.00717.47
8.1.60.0090.00917.70
8.1.50.0130.00617.56
8.1.40.0110.00817.55
8.1.30.0130.00717.65
8.1.20.0150.00317.66
8.1.10.0150.00517.61
8.1.00.0140.00417.49
8.0.300.0000.00920.21
8.0.290.0050.00216.63
8.0.280.0030.00318.43
8.0.270.0000.00716.74
8.0.260.0000.01016.73
8.0.250.0120.00416.82
8.0.240.0100.00616.82
8.0.230.0030.01316.85
8.0.220.0060.00816.77
8.0.210.0100.00416.77
8.0.200.0150.00116.82
8.0.190.0100.00516.81
8.0.180.0110.00516.77
8.0.170.0120.00516.84
8.0.160.0140.00216.84
8.0.150.0090.00516.79
8.0.140.0120.00316.78
8.0.130.0050.01016.79
8.0.120.0050.01016.79
8.0.110.0090.00616.71
8.0.100.0050.01116.73
8.0.90.0050.01016.76
8.0.80.0090.00716.82
8.0.70.0120.00316.77
8.0.60.0120.00416.72
8.0.50.0080.00816.73
8.0.30.0150.00016.70
8.0.20.0110.00516.85
8.0.10.0090.00616.90
7.4.330.0030.00315.55
7.4.320.0120.00416.33
7.4.300.0110.00616.43
7.4.290.0100.00716.44
7.4.280.0130.00316.49
7.4.270.0130.00216.43
7.4.260.0120.00416.41
7.4.250.0130.00316.36
7.4.240.0090.00616.44
7.4.230.0150.00116.46
7.4.220.0090.00616.45
7.4.210.0080.00516.40
7.4.200.0120.00316.41
7.4.190.0140.00216.43
7.4.180.0140.00116.40
7.4.160.0110.00216.47
7.4.150.0080.00716.40
7.4.140.0070.00716.31
7.4.130.0110.00216.37
7.4.120.0030.00617.24
7.4.110.0080.00217.31
7.4.100.0100.00316.46
7.4.90.0120.00216.31
7.4.80.0070.00216.29
7.4.70.0040.00716.29
7.4.60.0060.00216.25
7.4.50.0110.00216.35
7.4.40.0100.00416.23
7.4.30.0090.00516.37
7.4.20.0060.00416.01
7.4.10.0070.00416.36
7.4.00.0050.00516.38

preferences:
71.74 ms | 403 KiB | 5 Q