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; array_multisort( array_map( function ($row) use ($maxConsecutive) { static $encountered; $encountered[$row['type']] ??= 0; return intdiv($encountered[$row['type']]++, $maxConsecutive); }, $items ), array_column($items, 'type'), $items ); var_export($items);

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.120.0120.00520.64
8.4.110.0040.00522.46
8.4.100.0130.00720.63
8.4.90.0150.00520.71
8.4.80.0030.00422.42
8.4.70.0140.00718.21
8.4.60.0070.00518.82
8.4.50.0110.01118.73
8.4.40.0150.00317.61
8.4.30.0100.01018.83
8.4.20.0070.01120.68
8.4.10.0090.00019.31
8.3.250.0100.00919.00
8.3.240.0070.00516.63
8.3.230.0100.00916.47
8.3.220.0110.00719.00
8.3.210.0100.00816.56
8.3.200.0050.00416.70
8.3.190.0090.00918.91
8.3.180.0070.01016.79
8.3.170.0150.00418.87
8.3.160.0040.00418.36
8.3.150.0070.01118.60
8.3.140.0000.00816.76
8.3.130.0040.00418.40
8.3.120.0070.01118.84
8.3.110.0030.00820.94
8.3.100.0090.00316.62
8.3.90.0060.00326.77
8.3.80.0060.00318.30
8.3.70.0100.00718.68
8.3.60.0110.01118.31
8.3.50.0090.00616.56
8.3.40.0090.00620.20
8.3.30.0090.00621.69
8.3.20.0000.00724.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0050.00520.42
8.2.280.0160.00318.31
8.2.270.0110.00717.53
8.2.260.0080.01120.18
8.2.250.0160.00318.33
8.2.240.0030.00617.28
8.2.230.0070.00722.58
8.2.220.0060.00324.06
8.2.210.0000.00826.77
8.2.200.0030.00616.50
8.2.190.0130.01016.59
8.2.180.0110.01116.38
8.2.170.0090.00618.96
8.2.160.0070.00722.96
8.2.150.0030.00625.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00520.66
8.2.110.0130.00622.25
8.2.100.0140.00721.02
8.2.90.0170.00720.56
8.2.80.0140.00720.51
8.2.70.0070.01120.37
8.2.60.0140.01718.90
8.2.50.0100.01021.57
8.2.40.0160.00320.70
8.2.30.0240.00318.66
8.2.20.0180.00020.93
8.2.10.0150.00320.93
8.2.00.0100.00720.80
8.1.330.0140.00621.89
8.1.320.0110.00716.08
8.1.310.0090.00620.32
8.1.300.0050.00319.86
8.1.290.0030.00618.88
8.1.280.0170.00325.92
8.1.270.0050.00223.99
8.1.260.0040.00426.35
8.1.250.0090.00028.09
8.1.240.0070.01420.44
8.1.230.0150.00418.70
8.1.220.0180.00418.70
8.1.210.0190.00419.87
8.1.200.0160.00818.41
8.1.190.0130.00721.38
8.1.180.0110.01518.56
8.1.170.0090.00618.47
8.1.160.0110.01118.82
8.1.150.0100.00020.54
8.1.140.0200.00718.29
8.1.130.0130.01018.61
8.1.120.0060.01018.63
8.1.110.0160.00719.72
8.1.100.0070.01118.42
8.1.90.0100.00718.70
8.1.80.0110.00718.65
8.1.70.0190.00018.76
8.1.60.0140.01418.79
8.1.50.0200.00018.46
8.1.40.0130.00018.84
8.1.30.0030.00718.99
8.1.20.0070.01120.48
8.1.10.0060.01218.68
8.1.00.0120.00618.42
8.0.300.0100.00317.89
8.0.290.0030.00917.90
8.0.280.0050.00517.95
8.0.270.0260.00017.77
8.0.260.0080.00320.22
8.0.250.0100.00317.82
8.0.240.0030.00717.82
8.0.230.0100.00018.18
8.0.220.0060.00617.82
8.0.210.0070.00317.74
8.0.200.0080.00317.58
8.0.190.0030.00620.16
8.0.180.0090.00019.63
8.0.170.0050.00519.57
8.0.160.0110.00617.96
8.0.150.0030.00619.75
8.0.140.0120.00017.71
8.0.130.0050.00519.80
8.0.120.0130.00017.70
8.0.110.0060.00320.09
8.0.100.0070.00317.84
8.0.90.0070.00717.88
8.0.80.0060.00617.79
8.0.70.0080.00419.69
8.0.60.0090.00020.11
8.0.50.0070.00319.54
8.0.30.0060.00320.14
8.0.20.0080.00019.73
8.0.10.0090.00019.68

preferences:
35.63 ms | 403 KiB | 5 Q