3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['one' => 'data 1'], ['two' => 'data 2'], ['two' => 'data 3'], ['three' => 'data 4'], ['two' => 'data 5'], ['two' => 'data 6'], ['two' => 'data 7'], ['four' => 'data 8'], ]; $result = array_reduce($array, function ($c, $a) { $len = count($c); $key = key($a); if ($key == key($c[$len-1] ?? [])) { if (is_array($c[$len-1][$key])) { $c[$len-1][$key][]= $a[$key]; } else { $c[$len-1][$key] = array($c[$len-1][$key], $a[$key]); } } else { $c[] = $a; } return $c; }, []); 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.5.30.0080.00817.30
8.5.20.0050.00321.87
8.5.10.0080.00016.73
8.5.00.0150.00819.99
8.4.180.0150.00619.70
8.4.170.0120.01020.45
8.4.160.0120.01021.48
8.4.150.0090.00517.79
8.4.140.0120.00917.32
8.4.130.0050.00517.64
8.4.120.0050.00424.16
8.4.110.0130.00522.20
8.4.100.0130.00718.36
8.4.90.0140.00618.66
8.4.80.0030.00518.58
8.4.70.0070.01418.04
8.4.60.0110.01018.89
8.4.50.0110.00822.15
8.4.40.0060.00919.34
8.4.30.0090.00020.55
8.4.20.0090.00019.80
8.4.10.0060.00320.58
8.3.300.0120.00820.69
8.3.290.0100.00920.92
8.3.280.0120.00718.44
8.3.270.0090.01016.56
8.3.260.0120.00716.57
8.3.250.0080.01018.85
8.3.240.0110.00917.22
8.3.230.0080.00116.60
8.3.220.0120.00719.10
8.3.210.0070.00818.29
8.3.200.0050.00416.68
8.3.190.0120.00617.29
8.3.180.0070.00216.65
8.3.170.0080.00818.94
8.3.160.0100.00718.80
8.3.150.0070.01120.75
8.3.140.0060.01316.79
8.3.130.0000.00916.89
8.3.120.0130.00618.94
8.3.110.0130.00620.94
8.3.100.0030.00616.75
8.3.90.0080.00826.77
8.3.80.0030.00616.88
8.3.70.0070.00716.61
8.3.60.0070.01416.88
8.3.50.0100.00724.40
8.3.40.0070.01320.29
8.3.30.0120.00918.85
8.3.20.0000.00824.18
8.3.10.0070.00024.66
8.3.00.0080.00026.16
8.2.300.0100.01022.28
8.2.290.0130.00620.50
8.2.280.0120.00718.79
8.2.270.0110.00817.11
8.2.260.0000.00918.46
8.2.250.0000.00816.86
8.2.240.0000.00917.22
8.2.230.0050.00522.58
8.2.220.0040.01524.06
8.2.210.0060.01226.77
8.2.200.0070.00316.75
8.2.190.0090.00616.63
8.2.180.0110.00425.92
8.2.170.0130.00618.91
8.2.160.0110.00722.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0030.01426.16
8.2.120.0050.00226.35
8.2.110.0090.00019.39
8.2.100.0080.00317.84
8.2.90.0000.00917.75
8.2.80.0040.00418.73
8.2.70.0000.00817.50
8.2.60.0050.00317.63
8.2.50.0000.00818.05
8.2.40.0000.00718.16
8.2.30.0000.00718.26
8.2.20.0040.00418.22
8.2.10.0070.00019.41
8.2.00.0000.00719.25
8.1.340.0120.01117.66
8.1.330.0090.01022.06
8.1.320.0140.00615.76
8.1.310.0040.00418.68
8.1.300.0050.00518.62
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0000.00828.09
8.1.250.0050.00328.09
8.1.240.0090.00019.59
8.1.230.0040.00817.70
8.1.220.0000.00817.79
8.1.210.0050.00318.77
8.1.200.0030.00617.36
8.1.190.0000.00817.36
8.1.180.0030.00518.10
8.1.170.0060.00319.02
8.1.160.0080.00018.96
8.1.150.0000.00718.92
8.1.140.0040.00418.87
8.1.130.0030.00320.21
8.1.120.0000.00717.54
8.1.110.0040.00417.39
8.1.100.0090.00017.43
8.1.90.0000.00717.51
8.1.80.0050.00317.55
8.1.70.0040.00417.46
8.1.60.0040.00417.63
8.1.50.0030.00617.46
8.1.40.0080.00017.53
8.1.30.0040.00717.58
8.1.20.0040.00417.68
8.1.10.0050.00317.59
8.1.00.0050.00317.56
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0030.00318.43
8.0.270.0000.00818.08
8.0.260.0030.00318.50
8.0.250.0000.00716.93
8.0.240.0050.00316.88
8.0.230.0030.00316.97
8.0.220.0040.00416.95
8.0.210.0000.00716.80
8.0.200.0030.00317.00
8.0.190.0000.00817.05
8.0.180.0070.00016.92
8.0.170.0030.00516.79
8.0.160.0040.00416.96
8.0.150.0000.00916.97
8.0.140.0040.00416.86
8.0.130.0030.00313.34
8.0.120.0050.00316.93
8.0.110.0000.00816.93
8.0.100.0000.00716.96
8.0.90.0000.00716.82
8.0.80.0080.00816.93
8.0.70.0000.00916.96
8.0.60.0000.00716.92
8.0.50.0070.00016.94
8.0.30.0060.01217.06
8.0.20.0130.00517.19
8.0.10.0040.00417.04
8.0.00.0070.01116.80
7.4.330.0000.00515.55
7.4.320.0000.00616.54
7.4.300.0000.00616.39
7.4.290.0070.00016.55
7.4.280.0060.00316.62
7.4.270.0040.00416.61
7.4.260.0060.00013.31
7.4.250.0040.00416.61
7.4.240.0070.00016.53
7.4.230.0000.00716.45
7.4.220.0020.00616.35
7.4.210.0030.01116.60
7.4.200.0000.00716.43
7.4.130.0140.00216.50
7.4.120.0170.00016.61
7.4.110.0060.01016.49
7.4.100.0040.01816.52
7.4.90.0150.00416.50
7.4.80.0060.01216.38
7.4.70.0200.00316.46
7.4.60.0170.00716.48
7.4.50.0100.01316.59
7.4.40.0000.01816.39
7.4.30.0070.01216.36
7.4.20.0110.01116.63
7.4.10.0070.01116.57
7.4.00.0160.00816.69
7.3.330.0030.00316.37
7.3.320.0060.00013.46
7.3.310.0020.00516.38
7.3.300.0040.00416.40
7.3.290.0070.01016.38
7.3.260.0060.01016.37
7.3.230.0000.01716.46
7.3.220.0100.00716.26
7.3.210.0100.01416.56
7.3.200.0060.01116.34
7.3.190.0090.00916.43
7.3.180.0070.01016.39
7.3.170.0130.01316.31
7.3.160.0070.01316.68
7.3.150.0140.00816.32
7.3.140.0100.01416.55
7.3.130.0120.01216.41
7.3.120.0100.01016.39
7.3.110.0140.00316.61
7.3.100.0110.00716.61
7.3.90.0060.01216.61
7.3.80.0130.01016.34
7.3.70.0150.00316.46
7.3.60.0070.01016.42
7.3.50.0140.00716.37
7.3.40.0100.00716.29
7.3.30.0070.01016.37
7.3.20.0110.01116.43
7.3.10.0120.00616.35
7.3.00.0100.00816.35
7.2.330.0170.00716.68
7.2.320.0100.00916.80
7.2.310.0120.00616.85
7.2.300.0120.00616.63
7.2.290.0060.01216.33
7.2.280.0110.01416.87
7.2.270.0060.01616.51
7.2.260.0170.00716.46
7.2.250.0120.01216.71
7.2.240.0060.01616.56
7.2.230.0030.01716.70
7.2.220.0090.01216.75
7.2.210.0170.00916.71
7.2.200.0120.00616.70
7.2.190.0100.01016.56
7.2.180.0100.01416.68
7.2.170.0120.00616.66
7.2.160.0090.01216.60
7.2.150.0130.00916.59
7.2.140.0100.01416.77
7.2.130.0100.01016.78
7.2.120.0130.00616.64
7.2.110.0150.00916.53
7.2.100.0160.00316.70
7.2.90.0070.01816.69
7.2.80.0160.00516.56
7.2.70.0090.00916.75
7.2.60.0140.01116.50
7.2.50.0200.00716.58
7.2.40.0130.00516.71
7.2.30.0200.00616.66
7.2.20.0140.00516.51
7.2.10.0110.00716.75
7.2.00.0110.00716.59

preferences:
50 ms | 1626 KiB | 5 Q