3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 0 => [ 0 => [ "Product_Name" => "Apple Pie - 8", "Product_Qty" => 1, "Product_Cat" => "Pies" ], 1 => [ "Product_Name" => "Apple Pie - 8", "Product_Qty" => 1, "Product_Cat" => "Pies" ] ], 1 => [ 0 => [ "Product_Name" => "Pecan Pie - 8", "Product_Qty" => 1, "Product_Cat" => "Pies" ] ], 2 => [ 0 => [ "Product_Name" => "Strawberry Pie - 8", "Product_Qty" => 1, "Product_Cat" => "Pies" ], 1 => [ "Product_Name" => "Pecan Pie - 8", "Product_Qty" => 1, "Product_Cat" => "Pies" ] ], 3 => [ 0 => [ "Product_Name" => "Lemon Pie - 8", "Product_Qty" => 1, "Product_Cat" => "Pies" ], 1 => [ "Product_Name" => "Pecan Pie - 8", "Product_Qty" => 1, "Product_Cat" => "Pies" ] ] ]; $result = []; foreach ($array as $set) { foreach ($set as ['Product_Name' => $n, 'Product_Qty' => $q]) { $result[$n] = ($result[$n] ?? 0) + $q; } } 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.0120.00717.77
8.4.120.0110.00820.70
8.4.110.0140.00422.77
8.4.100.0130.00717.75
8.4.90.0120.00818.39
8.4.80.0080.00719.52
8.4.70.0090.01117.84
8.4.60.0030.00524.21
8.4.50.0060.00320.41
8.4.40.0160.00017.63
8.4.30.0030.00518.90
8.4.20.0140.00718.13
8.4.10.0130.00319.12
8.3.260.0120.00716.36
8.3.250.0110.00718.89
8.3.240.0120.00716.82
8.3.230.0080.00216.57
8.3.220.0110.00617.09
8.3.210.0080.01018.61
8.3.200.0040.00416.48
8.3.190.0110.00416.96
8.3.180.0130.00618.73
8.3.170.0070.01020.72
8.3.160.0100.00717.25
8.3.150.0030.00616.47
8.3.140.0080.00017.07
8.3.130.0000.00818.38
8.3.120.0030.00719.09
8.3.110.0060.00320.94
8.3.100.0190.00016.66
8.3.90.0040.00418.36
8.3.80.0030.00618.30
8.3.70.0090.00616.75
8.3.60.0110.01118.37
8.3.50.0120.00318.38
8.3.40.0090.00923.84
8.3.30.0130.00320.39
8.3.20.0070.00024.18
8.3.10.0130.00723.56
8.3.00.0170.00320.73
8.2.290.0050.00322.43
8.2.280.0140.00518.43
8.2.270.0130.00616.50
8.2.260.0100.00716.86
8.2.250.0070.00716.66
8.2.240.0040.01116.94
8.2.230.0160.00322.58
8.2.220.0000.00824.06
8.2.210.0050.00326.77
8.2.200.0100.00018.42
8.2.190.0140.00316.58
8.2.180.0070.01116.50
8.2.170.0070.00718.75
8.2.160.0030.01022.96
8.2.150.0000.00725.66
8.2.140.0180.00322.14
8.2.130.0130.00322.25
8.2.120.0120.00420.69
8.2.110.0030.01220.70
8.2.100.0070.01320.74
8.2.90.0100.01020.59
8.2.80.0130.00321.05
8.2.70.0150.00620.54
8.2.60.0160.00020.50
8.2.50.0040.00420.55
8.2.40.0030.00620.69
8.2.30.0090.00020.40
8.2.20.0050.00320.61
8.2.10.0030.00620.38
8.2.00.0080.00020.61
8.1.330.0090.01022.02
8.1.320.0100.00817.93
8.1.310.0080.00015.96
8.1.300.0040.00418.38
8.1.290.0060.00318.88
8.1.280.0090.00625.92
8.1.270.0070.00023.96
8.1.260.0050.00323.90
8.1.250.0050.00323.84
8.1.240.0040.00420.43
8.1.230.0040.00420.20
8.1.220.0080.00020.65
8.1.210.0080.00020.30
8.1.200.0040.00420.66
8.1.190.0050.00320.41
8.1.180.0050.00320.16
8.1.170.0080.00020.40
8.1.160.0040.00420.22
8.1.150.0040.00420.26
8.1.140.0040.00420.34
8.1.130.0000.00820.40
8.1.120.0060.00320.38
8.1.110.0050.00320.32
8.1.100.0050.00320.27
8.1.90.0000.00820.41
8.1.80.0060.00320.41
8.1.70.0050.00320.28
8.1.60.0000.00820.46
8.1.50.0080.00020.37
8.1.40.0040.00420.55
8.1.30.0040.00420.56
8.1.20.0040.00420.53
8.1.10.0030.00520.38
8.1.00.0080.00020.27

preferences:
26.57 ms | 403 KiB | 5 Q