3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array( "name" => "SomeName", "type" => "A"), array( "name" => "SomeName", "type" => "A"), array( "name" => "SomeName", "type" => "A"), array( "name" => "SomeName", "type" => "A"), array( "name" => "SomeName", "type" => "A"), array( "name" => "SomeName", "type" => "B"), array( "name" => "SomeName", "type" => "B"), array( "name" => "SomeName", "type" => "B"), array( "name" => "SomeName", "type" => "C"), array( "name" => "SomeName", "type" => "C") ); // split data into arrays of distinct type $buckets = array_reduce($data, function($result, $item) { $type = $item["type"]; if (!isset($result[$type])) { $result[$type] = []; } array_push($result[$type], $item); return $result; }, []); // sort buckets by size usort($buckets, function($a, $b) { return count($b) - count($a); }); // merge buckets to single array sorted by type // and split to chunks of size of the largest bucket $table = array_chunk(array_merge(...$buckets), count($buckets[0])); // compute final array by merging each column $result = []; foreach (array_keys($table[0]) as $i) { $result = array_merge($result, array_column($table, $i)); } print_r($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.10.0100.00719.72
8.3.140.0060.01217.13
8.3.130.0000.01016.63
8.3.120.0000.00918.93
8.3.110.0090.00920.94
8.3.100.0000.01018.35
8.3.90.0050.00316.74
8.3.80.0060.00317.97
8.3.70.0110.00716.61
8.3.60.0160.00316.50
8.3.50.0120.01021.98
8.3.40.0110.00418.79
8.3.30.0110.00418.84
8.3.20.0040.00421.68
8.3.10.0000.00821.92
8.3.00.0000.00820.89
8.2.250.0100.01016.68
8.2.240.0080.00017.44
8.2.230.0050.00322.58
8.2.220.0090.00624.06
8.2.210.0130.00626.77
8.2.200.0060.00316.75
8.2.190.0090.00916.58
8.2.180.0100.01018.42
8.2.170.0110.00422.96
8.2.160.0070.00720.47
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00418.21
8.2.120.0080.00026.35
8.2.110.0090.00021.00
8.2.100.0090.00317.84
8.2.90.0030.00617.90
8.2.80.0060.00319.95
8.2.70.0050.00317.75
8.2.60.0050.00317.50
8.2.50.0030.00617.63
8.2.40.0000.01017.63
8.2.30.0000.00720.47
8.2.20.0000.00718.03
8.2.10.0030.00618.21
8.2.00.0040.00417.83
8.1.300.0120.00417.83
8.1.290.0030.00718.88
8.1.280.0140.00425.92
8.1.270.0030.00523.84
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00322.14
8.1.230.0100.00320.89
8.1.220.0000.00917.78
8.1.210.0090.00018.89
8.1.200.0030.00517.35
8.1.190.0080.00017.22
8.1.180.0040.00418.10
8.1.170.0080.00318.52
8.1.160.0070.00018.97
8.1.150.0050.00218.67
8.1.140.0050.00219.65
8.1.130.0000.00719.04
8.1.120.0000.00817.50
8.1.110.0000.00717.46
8.1.100.0040.00417.34
8.1.90.0000.00717.46
8.1.80.0000.00717.49
8.1.70.0040.00417.38
8.1.60.0040.00417.62
8.1.50.0000.00817.43
8.1.40.0030.00517.45
8.1.30.0060.00317.53
8.1.20.0080.00017.69
8.1.10.0070.00017.63
8.1.00.0070.00017.55
8.0.300.0000.00719.86
8.0.290.0000.00716.75
8.0.280.0040.00418.38
8.0.270.0070.00017.14
8.0.260.0060.00317.19
8.0.250.0000.00716.89
8.0.240.0040.00416.98
8.0.230.0000.00716.96
8.0.220.0000.00716.93
8.0.210.0000.00716.92
8.0.200.0050.00316.97
8.0.190.0050.00316.99
8.0.180.0040.00416.84
8.0.170.0030.00516.89
8.0.160.0070.00016.93
8.0.150.0000.00716.74
8.0.140.0040.00416.84
8.0.130.0060.00013.34
8.0.120.0040.00416.91
8.0.110.0090.00016.73
8.0.100.0020.00516.90
8.0.90.0070.00016.70
8.0.80.0090.00616.96
8.0.70.0000.00716.79
8.0.60.0000.00716.76
8.0.50.0070.00016.78
8.0.30.0130.00517.21
8.0.20.0120.01017.40
8.0.10.0000.00717.05
8.0.00.0120.01216.84
7.4.330.0020.00215.55
7.4.320.0060.00016.55
7.4.300.0060.00016.44
7.4.290.0070.00016.61
7.4.280.0060.00316.38
7.4.270.0070.00016.63
7.4.260.0070.00316.49
7.4.250.0050.00216.39
7.4.240.0080.00016.63
7.4.230.0040.00416.34
7.4.220.0100.00716.45
7.4.210.0040.01116.49
7.4.200.0030.00616.71
7.4.160.0060.00916.36
7.4.150.0100.00717.40
7.4.140.0100.00917.86
7.4.130.0070.00916.58
7.4.120.0090.00916.58
7.4.110.0080.01116.80
7.4.100.0140.00316.58
7.4.90.0060.01216.57
7.4.80.0100.00719.39
7.4.70.0060.01016.42
7.4.60.0060.01016.54
7.4.50.0070.01016.53
7.4.40.0130.00316.73
7.4.30.0090.00916.51
7.4.00.0080.00614.98
7.3.330.0060.00013.35
7.3.320.0000.00513.25
7.3.310.0000.00716.38
7.3.300.0000.00716.33
7.3.290.0110.00816.36
7.3.280.0070.01016.34
7.3.270.0100.00717.40
7.3.260.0110.00916.41
7.3.250.0060.01016.44
7.3.240.0120.00916.52
7.3.230.0000.01616.45
7.3.210.0120.00616.30
7.3.200.0060.01016.68
7.3.190.0040.02016.71
7.3.180.0060.00916.69
7.3.170.0080.00916.52
7.3.160.0040.01216.45
7.3.120.0110.00614.60
7.3.110.0070.01314.57
7.3.100.0040.01114.83
7.3.90.0000.01314.93
7.3.80.0080.00815.01
7.3.70.0080.00714.75
7.3.60.0080.00514.93
7.3.50.0070.00614.75
7.3.40.0080.00714.86
7.3.30.0060.00914.78
7.3.20.0060.01016.77
7.3.10.0040.01016.69
7.3.00.0110.00516.67
7.2.330.0060.01216.85
7.2.320.0140.00316.42
7.2.310.0110.00716.52
7.2.300.0070.01216.69
7.2.290.0180.00616.69
7.2.250.0070.01115.02
7.2.240.0120.00914.82
7.2.230.0100.00614.87
7.2.220.0100.00315.07
7.2.210.0030.01015.02
7.2.200.0120.00415.12
7.2.190.0050.00815.16
7.2.180.0000.01215.05
7.2.170.0020.01515.10
7.2.160.0060.00814.63
7.2.150.0090.00616.70
7.2.140.0110.00417.07
7.2.130.0040.01016.82
7.2.120.0050.00916.70
7.2.110.0090.00916.73
7.2.100.0100.01016.91
7.2.90.0050.00916.74
7.2.80.0080.00316.78
7.2.70.0040.01116.79
7.2.60.0070.00816.97
7.2.50.0090.00616.95
7.2.40.0120.00016.81
7.2.30.0030.01016.76
7.2.20.0070.00716.78
7.2.10.0090.00616.97
7.2.00.0070.01116.92
7.1.330.0070.01115.81
7.1.320.0070.00715.93
7.1.310.0060.00315.77
7.1.300.0060.00615.83
7.1.290.0050.00715.92
7.1.280.0070.00815.80
7.1.270.0020.01215.78
7.1.260.0090.00215.86
7.1.250.0080.00315.90
7.1.240.0110.00815.65
7.1.230.0090.01015.73
7.1.220.0100.01415.73
7.1.210.0090.00715.61
7.1.200.0090.00715.86
7.1.190.0160.00615.95
7.1.180.0110.00815.75
7.1.170.0160.00515.68
7.1.160.0120.00915.81
7.1.150.0110.00515.66
7.1.140.0120.00615.95
7.1.130.0100.01315.97
7.1.120.0150.00315.46
7.1.110.0080.01115.94
7.1.100.0140.01015.79
7.1.90.0120.00915.72
7.1.80.0160.00915.78
7.1.70.0110.00816.47
7.1.60.0090.00716.38
7.1.50.0110.00615.55
7.1.40.0150.00515.72
7.1.30.0070.01015.96
7.1.20.0140.04128.15
7.1.10.0120.03618.88
7.1.00.0100.04118.95
7.0.330.0160.01315.25
7.0.320.0230.00315.45
7.0.310.0110.00915.36
7.0.300.0130.00515.30
7.0.290.0140.00715.41
7.0.280.0140.00915.35
7.0.270.0110.01115.16
7.0.260.0150.01015.46
7.0.250.0120.01015.39
7.0.240.0150.01115.36
7.0.230.0100.01015.41
7.0.220.0160.00815.39
7.0.210.0140.00715.23
7.0.200.0120.00416.04
7.0.190.0150.00515.32
7.0.180.0120.00915.37
7.0.170.0110.00615.46
7.0.160.0110.04418.47
7.0.150.0120.03218.62
7.0.140.0130.03518.66
7.0.130.0170.03018.71
7.0.120.0170.02818.71
7.0.110.0150.03518.63
7.0.100.0110.03118.59
7.0.90.0160.03018.69
7.0.80.0150.03318.64
7.0.70.0110.03618.61
7.0.60.0210.03218.66
7.0.50.0190.02818.60
7.0.40.0130.03518.66
7.0.30.0070.03718.61
7.0.20.0140.03418.73
7.0.10.0120.03418.60
7.0.00.0120.03518.54
5.6.400.0130.01314.39
5.6.390.0120.01614.26
5.6.380.0040.01714.29

preferences:
76.11 ms | 403 KiB | 5 Q