3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = array( [ 'id' => 12, 'group' => 'abc', 'name' => 'Lorem', ], [ 'id' => 12, 'group' => 'def', 'name' => 'Ipsum', ], [ 'id' => 34, 'group' => 'ghi', 'name' => 'Dolor', ], [ 'id' => 34, 'group' => 'jkl', 'name' => 'Sit', ], [ 'id' => 34, 'group' => 'mno', 'name' => 'Amet', ], ); $grouped = array_reduce($products, function ($c, $v) { $c[$v['id']][$v['group']] = $v; return $c; }, []); print_r($grouped); $products[] = [ 'id' => 34, 'group' => 'jkl', 'name' => 'Consectetur', ]; $grouped = array_reduce($products, function ($c, $v) { $c[$v['id']][$v['group']] = $v; return $c; }, []); print_r($grouped); $grouped = array_reduce($products, function ($c, $v) { $c[$v['id']][$v['group']][] = $v; return $c; }, []); print_r($grouped);

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.140.0100.01217.43
8.4.130.0040.00618.87
8.4.120.0060.00223.83
8.4.110.0120.00919.04
8.4.100.0120.00818.90
8.4.90.0150.00522.46
8.4.80.0100.01017.89
8.4.70.0120.00618.01
8.4.60.0060.00417.97
8.4.50.0110.01017.53
8.4.40.0100.01017.81
8.4.30.0100.01020.87
8.4.20.0140.00724.26
8.4.10.0060.00319.34
8.3.270.0110.00916.50
8.3.260.0050.01116.88
8.3.250.0140.00418.88
8.3.240.0120.00617.42
8.3.230.0050.00416.48
8.3.220.0110.00719.07
8.3.210.0090.00616.61
8.3.200.0120.00816.86
8.3.190.0090.00818.48
8.3.180.0120.00716.35
8.3.170.0110.00716.61
8.3.160.0200.00018.49
8.3.150.0060.01219.05
8.3.140.0040.00419.18
8.3.130.0050.00318.35
8.3.120.0030.00618.92
8.3.110.0080.00020.94
8.3.100.0100.01016.47
8.3.90.0050.00526.77
8.3.80.0040.00819.36
8.3.70.0120.00916.75
8.3.60.0070.01416.50
8.3.50.0160.00323.51
8.3.40.0070.00720.15
8.3.30.0070.00718.70
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0050.00326.16
8.2.290.0090.01020.56
8.2.280.0060.00318.51
8.2.270.0110.00718.70
8.2.260.0110.00316.60
8.2.250.0100.01016.63
8.2.240.0090.00017.43
8.2.230.0000.00822.58
8.2.220.0000.00924.06
8.2.210.0040.00426.77
8.2.200.0040.00718.16
8.2.190.0090.00616.58
8.2.180.0090.00625.92
8.2.170.0070.00719.14
8.2.160.0000.02022.96
8.2.150.0070.00025.66
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00421.00
8.2.110.0060.00320.51
8.2.100.0080.00417.84
8.2.90.0000.00720.47
8.2.80.0000.00818.18
8.2.70.0090.00018.04
8.2.60.0000.00818.16
8.2.50.0000.00818.10
8.2.40.0040.00419.35
8.2.30.0080.00019.32
8.2.20.0040.00418.12
8.2.10.0040.00419.31
8.2.00.0000.00719.43
8.1.330.0090.00922.16
8.1.320.0080.01116.02
8.1.310.0000.00818.72
8.1.300.0060.01016.66
8.1.290.0080.00418.88
8.1.280.0090.00925.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0040.00422.14
8.1.230.0040.00820.97
8.1.220.0050.00517.74
8.1.210.0080.00018.90
8.1.200.0080.00017.35
8.1.190.0000.00817.48
8.1.180.0000.00818.10
8.1.170.0040.00418.57
8.1.160.0030.00718.90
8.1.150.0070.00019.00
8.1.140.0050.00318.96
8.1.130.0030.00320.18
8.1.120.0040.00417.37
8.1.110.0000.00817.38
8.1.100.0000.00817.49
8.1.90.0000.00717.35
8.1.80.0000.00917.49
8.1.70.0000.00717.46
8.1.60.0030.00617.58
8.1.50.0030.00617.42
8.1.40.0040.00417.55
8.1.30.0000.00817.59
8.1.20.0000.00817.55
8.1.10.0000.00917.53
8.1.00.0080.00017.37
8.0.300.0000.00719.91
8.0.290.0060.00316.63
8.0.280.0070.00018.41
8.0.270.0000.00716.85
8.0.260.0060.00018.37
8.0.250.0030.00316.93
8.0.240.0070.00016.83
8.0.230.0050.00316.99
8.0.220.0000.00816.79
8.0.210.0070.00016.85
8.0.200.0050.00516.87
8.0.190.0070.00016.88
8.0.180.0040.00416.84
8.0.170.0030.00616.82
8.0.160.0050.00216.93
8.0.150.0060.00316.77
8.0.140.0080.00016.92
8.0.130.0000.00613.38
8.0.120.0050.00316.92
8.0.110.0040.00416.71
8.0.100.0040.00416.84
8.0.90.0040.00416.87
8.0.80.0060.00916.81
8.0.70.0060.00316.94
8.0.60.0040.00416.86
8.0.50.0000.00716.93
8.0.30.0110.01417.24
8.0.20.0130.00817.01
8.0.10.0000.00717.15
8.0.00.0160.00616.91
7.4.330.0040.00415.55
7.4.320.0000.00616.63
7.4.300.0040.00416.51
7.4.290.0040.00416.63
7.4.280.0030.00616.62
7.4.270.0070.00016.67
7.4.260.0050.00013.29
7.4.250.0000.00716.60
7.4.240.0000.00816.57
7.4.230.0030.00316.69
7.4.220.0000.00716.55
7.4.210.0070.00916.60
7.4.200.0030.00516.56
7.4.130.0080.01016.44
7.4.120.0120.00816.48
7.4.110.0080.01216.61
7.4.100.0150.00616.41
7.4.90.0110.01416.45
7.4.80.0070.01316.41
7.4.70.0140.00616.61
7.4.60.0090.00916.45
7.4.50.0060.01216.42
7.4.40.0150.00916.54
7.4.30.0100.00716.34
7.4.20.0130.00316.25
7.4.10.0150.00416.55
7.4.00.0060.01416.44
7.3.330.0000.00816.46
7.3.320.0030.00313.40
7.3.310.0020.00516.40
7.3.300.0030.00316.25
7.3.290.0090.00816.40
7.3.280.0070.00716.32
7.3.260.0210.00316.55
7.3.230.0090.01316.52
7.3.220.0160.00616.39
7.3.210.0080.00816.43
7.3.200.0180.00016.29
7.3.190.0100.00916.71
7.3.180.0070.01116.55
7.3.170.0130.01016.50
7.3.160.0190.00416.42
7.3.150.0100.00816.30
7.3.140.0140.00416.43
7.3.130.0060.01116.30
7.3.120.0140.00316.34
7.3.110.0140.01216.41
7.3.100.0130.00716.52
7.3.90.0070.01016.56
7.3.80.0120.00616.59
7.3.70.0130.00916.48
7.3.60.0220.00316.41
7.3.50.0120.01216.52
7.3.40.0080.01716.50
7.3.30.0140.00616.50
7.3.20.0130.01016.48
7.3.10.0130.01016.33
7.3.00.0080.01216.60
7.2.330.0080.01116.63
7.2.320.0210.00016.63
7.2.310.0040.01416.29
7.2.300.0060.01816.54
7.2.290.0210.00316.63
7.2.280.0040.01416.64
7.2.270.0090.01216.51
7.2.260.0110.00716.55
7.2.250.0100.01016.61
7.2.240.0090.00916.30
7.2.230.0160.00616.61
7.2.220.0150.00316.48
7.2.210.0160.00716.43
7.2.200.0130.01316.51
7.2.190.0130.01316.67
7.2.180.0170.01016.63
7.2.170.0220.00616.56
7.2.160.0120.01516.42
7.2.150.0150.00616.59
7.2.140.0100.01016.59
7.2.130.0170.00416.64
7.2.120.0110.01416.50
7.2.110.0150.00416.50
7.2.100.0140.00616.48
7.2.90.0090.01116.59
7.2.80.0240.00916.52
7.2.70.0120.00916.46
7.2.60.0120.01216.71
7.2.50.0160.00316.74
7.2.40.0110.00716.69
7.2.30.0180.00016.66
7.2.20.0060.01216.48
7.2.10.0140.00316.62
7.2.00.0140.00516.31

preferences:
29.98 ms | 403 KiB | 5 Q