3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = [ ['type' => 1, 'text' => 'A'], ['type' => 2, 'text' => 'B'], ['type' => 2, 'text' => 'C'], ['type' => 3, 'text' => 'D'], ['type' => 2, 'text' => 'E'], ['type' => 1, 'text' => 'F'], ['type' => 4, 'text' => 'G'], ['type' => 2, 'text' => 'H'], ['type' => 1, 'text' => 'I'], ['type' => 4, 'text' => 'J'], ['type' => 2, 'text' => 'K'], ['type' => 4, 'text' => 'L'], ['type' => 2, 'text' => 'M'], ['type' => 3, 'text' => 'N'], ['type' => 3, 'text' => 'O'], ['type' => 1, 'text' => 'P'], ['type' => 1, 'text' => 'Q'], ['type' => 2, 'text' => 'R'], ['type' => 3, 'text' => 'S'], ['type' => 2, 'text' => 'T'], ['type' => 3, 'text' => 'U'], ['type' => 2, 'text' => 'V'], ['type' => 3, 'text' => 'W'], ['type' => 2, 'text' => 'X'], ['type' => 4, 'text' => 'Y'], ['type' => 2, 'text' => 'Z'], ]; $maxConsecutive = 3; $grouped = []; foreach ($items as $row) { $grouped[$row['type']][] = $row; } ksort($grouped); $result = []; foreach ($grouped as &$group) { array_push($result, ...array_splice($group, 0, $maxConsecutive)); if ($group) { $grouped[] = $group; } } 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.0110.00918.74
8.4.120.0130.00724.01
8.4.110.0110.00822.12
8.4.100.0100.01117.78
8.4.90.0120.00918.71
8.4.80.0080.01119.69
8.4.70.0060.00317.97
8.4.60.0060.00418.45
8.4.50.0100.01019.63
8.4.40.0090.00017.80
8.4.30.0080.00018.75
8.4.20.0060.01320.59
8.4.10.0080.00019.42
8.3.260.0050.00316.50
8.3.250.0130.00719.23
8.3.240.0160.00316.93
8.3.230.0160.00316.51
8.3.220.0090.00917.08
8.3.210.0120.00716.88
8.3.200.0040.00516.59
8.3.190.0050.00418.73
8.3.180.0130.00716.61
8.3.170.0040.01418.94
8.3.160.0040.00716.62
8.3.150.0090.00918.60
8.3.140.0060.00318.95
8.3.130.0060.00316.90
8.3.120.0060.00318.80
8.3.110.0040.00420.94
8.3.100.0030.00624.06
8.3.90.0080.00026.77
8.3.80.0030.00617.97
8.3.70.0110.00618.56
8.3.60.0100.01018.68
8.3.50.0030.01216.85
8.3.40.0150.00620.07
8.3.30.0150.00021.98
8.3.20.0080.00024.18
8.3.10.0050.00324.66
8.3.00.0080.00026.16
8.2.290.0120.00620.41
8.2.280.0110.00918.23
8.2.270.0040.01417.23
8.2.260.0070.01118.17
8.2.250.0040.00416.77
8.2.240.0060.00318.88
8.2.230.0070.00322.58
8.2.220.0000.00937.54
8.2.210.0040.00426.77
8.2.200.0030.00616.50
8.2.190.0140.00716.75
8.2.180.0160.00616.63
8.2.170.0160.00318.94
8.2.160.0130.00722.96
8.2.150.0030.00625.66
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0040.00420.66
8.2.110.0130.00722.09
8.2.100.0150.00820.98
8.2.90.0280.00318.84
8.2.80.0200.01318.76
8.2.70.0110.00718.67
8.2.60.0070.01418.69
8.2.50.0150.00019.88
8.2.40.0080.00418.73
8.2.30.0130.00019.01
8.2.20.0140.00019.11
8.2.10.0030.00719.29
8.2.00.0070.00318.82
8.1.330.0110.00522.07
8.1.320.0120.00718.61
8.1.310.0090.00016.76
8.1.300.0060.00317.86
8.1.290.0070.00430.84
8.1.280.0090.00925.92
8.1.270.0090.00023.97
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0140.00018.57
8.1.230.0090.00618.65
8.1.220.0070.00718.67
8.1.210.0030.00619.80
8.1.200.0060.00318.52
8.1.190.0040.00719.49
8.1.180.0030.00620.17
8.1.170.0040.00420.38
8.1.160.0000.00820.64
8.1.150.0060.00322.06
8.1.140.0070.00220.04
8.1.130.0110.00318.59
8.1.120.0030.00918.40
8.1.110.0040.00819.81
8.1.100.0140.00018.56
8.1.90.0070.00718.42
8.1.80.0060.00618.49
8.1.70.0080.00318.89
8.1.60.0120.00018.59
8.1.50.0060.00918.57
8.1.40.0040.00418.92
8.1.30.0040.00718.94
8.1.20.0060.01018.66
8.1.10.0090.00018.75
8.1.00.0120.00018.72
8.0.300.0160.00017.86
8.0.290.0060.00617.88
8.0.280.0130.00017.90
8.0.270.0110.00417.77
8.0.260.0070.00418.40
8.0.250.0080.00017.94
8.0.240.0100.00317.73
8.0.230.0090.00318.32
8.0.220.0110.00017.93
8.0.210.0120.00317.83
8.0.200.0070.00717.88
8.0.190.0090.00418.04
8.0.180.0100.00517.85
8.0.170.0180.00018.00
8.0.160.0040.00819.64
8.0.150.0150.00017.94
8.0.140.0090.00317.75
8.0.130.0050.00518.18
8.0.120.0050.00517.61
8.0.110.0040.00818.24
8.0.100.0110.00317.71
8.0.90.0110.00417.73
8.0.80.0110.00417.89
8.0.70.0090.00617.66
8.0.60.0120.00018.20
8.0.50.0070.00717.83
8.0.30.0120.00018.34
8.0.20.0060.00917.86
8.0.10.0090.00617.91

preferences:
28.13 ms | 403 KiB | 5 Q