3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['_id' => '5f76b1788ee23077dccd1a2c', 'product' => ['_id'=>'5d0391a4a72ffe76b8fcc610'], 'count'=> 1], ['_id' => '5f76b6288ee2300700cd1a3a', 'product' => ['_id'=>'5d0391b6a72ffe76b8fcc611'], 'count'=> 1], ['_id' => '5f76d2488ee23083d3cd1a4a', 'product' => ['_id'=>'5d0391b6a72ffe76b8fcc611'], 'count'=> 1] ]; $productCounts = []; foreach ($array as $item) { $productId = $item['product']['_id']; $productCounts[$productId] = ($productCounts[$productId] ?? 0) + $item['count']; } var_export($productCounts);

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.3.60.0000.01518.05
8.3.50.0140.00716.51
8.3.40.0110.00421.86
8.3.30.0090.00618.71
8.3.20.0100.00024.18
8.3.10.0050.00324.66
8.3.00.0050.00226.16
8.2.180.0100.00725.92
8.2.170.0120.00619.00
8.2.160.0130.00022.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0030.00618.75
8.2.110.0070.00319.24
8.2.100.0110.00019.89
8.2.90.0000.00917.88
8.2.80.0030.00618.66
8.2.70.0000.00817.50
8.2.60.0040.00418.04
8.2.50.0030.00518.07
8.2.40.0090.00020.60
8.2.30.0000.00818.16
8.2.20.0000.00718.04
8.2.10.0040.00419.37
8.2.00.0050.00219.20
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00020.97
8.1.230.0070.00417.64
8.1.220.0000.00817.77
8.1.210.0000.00818.77
8.1.200.0090.00317.48
8.1.190.0050.00317.23
8.1.180.0040.00418.10
8.1.170.0040.00418.50
8.1.160.0040.00418.84
8.1.150.0000.00718.90
8.1.140.0060.00318.80
8.1.130.0030.00320.13
8.1.120.0040.00417.43
8.1.110.0040.00417.45
8.1.100.0000.00817.34
8.1.90.0080.00017.45
8.1.80.0040.00417.53
8.1.70.0000.00817.38
8.1.60.0000.00817.57
8.1.50.0050.00317.41
8.1.40.0030.00617.56
8.1.30.0000.00817.57
8.1.20.0050.00317.66
8.1.10.0040.00417.41
8.1.00.0120.00017.43
8.0.300.0080.00018.77
8.0.290.0040.00416.88
8.0.280.0000.00818.45
8.0.270.0040.00418.05
8.0.260.0030.00320.23
8.0.250.0000.00717.01
8.0.240.0030.00316.85
8.0.230.0070.00016.94
8.0.220.0000.00716.80
8.0.210.0070.00016.82
8.0.200.0000.00716.79
8.0.190.0000.00716.91
8.0.180.0040.00416.78
8.0.170.0030.00616.92
8.0.160.0000.00816.87
8.0.150.0000.00716.80
8.0.140.0080.00016.79
8.0.130.0030.00313.29
8.0.120.0040.00416.86
8.0.110.0030.00316.95
8.0.100.0000.00816.90
8.0.90.0070.00016.89
8.0.80.0080.01316.82
8.0.70.0040.00416.96
8.0.60.0070.00016.77
8.0.50.0000.00716.85
8.0.30.0050.01117.30
8.0.20.0080.01017.12
8.0.10.0040.00417.01
8.0.00.0090.00916.73
7.4.330.0020.00215.55
7.4.320.0030.00316.51
7.4.300.0040.00416.51
7.4.290.0000.00816.54
7.4.280.0000.00816.56
7.4.270.0040.00416.58
7.4.260.0050.00013.30
7.4.250.0070.00016.48
7.4.240.0070.00016.41
7.4.230.0000.00716.58
7.4.220.0050.00216.52
7.4.210.0090.00816.53
7.4.200.0080.00016.48
7.4.130.0080.00816.59
7.4.120.0060.01516.66
7.4.110.0060.01216.45
7.4.100.0090.00916.49
7.4.90.0100.00616.49
7.4.80.0100.00616.42
7.4.70.0100.00616.42
7.4.60.0000.01616.50
7.4.50.0030.01416.64
7.4.40.0060.01016.38
7.4.30.0030.01316.59
7.4.20.0120.01216.59
7.4.10.0100.00716.46
7.4.00.0070.01016.63
7.3.330.0050.00216.25
7.3.320.0050.00013.22
7.3.310.0000.00716.26
7.3.300.0030.00316.24
7.3.290.0100.00516.30
7.3.260.0140.00716.43
7.3.230.0100.00716.22
7.3.220.0100.00716.34
7.3.210.0080.00816.45
7.3.200.0040.01616.44
7.3.190.0070.01016.31
7.3.180.0060.00916.11
7.3.170.0110.00516.19
7.3.160.0090.00616.29
7.3.150.0080.00816.43
7.3.140.0040.01616.53
7.3.130.0150.00316.38
7.3.120.0090.00616.26
7.3.110.0120.01116.29
7.3.100.0100.01316.26
7.3.90.0130.01016.36
7.3.80.0120.00916.26
7.3.70.0100.00716.36
7.3.60.0080.01416.45
7.3.50.0080.01116.38
7.3.40.0120.00616.27
7.3.30.0130.00316.52
7.3.20.0070.01116.54
7.3.10.0120.00616.44
7.3.00.0100.01016.32
7.2.340.0090.00616.49
7.2.330.0070.01016.37
7.2.320.0140.00316.53
7.2.310.0040.01216.59
7.2.300.0040.01216.78
7.2.290.0090.00616.37
7.2.280.0100.00616.29
7.2.270.0150.00916.41
7.2.260.0120.00616.47
7.2.250.0100.01316.69
7.2.240.0150.00916.63
7.2.230.0240.00016.43
7.2.220.0140.00416.38
7.2.210.0070.01416.61
7.2.200.0120.00616.47
7.2.190.0090.01216.63
7.2.180.0100.00716.59
7.2.170.0100.00716.71
7.2.160.0100.00716.38
7.2.150.0070.01416.57
7.2.140.0090.01016.68
7.2.130.0130.01016.42
7.2.120.0070.01116.45
7.2.110.0130.00316.21
7.2.100.0160.00616.45
7.2.90.0100.00716.39
7.2.80.0060.01216.44
7.2.70.0070.01016.33
7.2.60.0070.01016.51
7.2.50.0100.00716.58
7.2.40.0100.00716.52
7.2.30.0060.01316.63
7.2.20.0100.00716.40
7.2.10.0170.00016.27
7.2.00.0090.00916.47

preferences:
33.56 ms | 400 KiB | 5 Q