3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = [ (object) ['group_id' => 'a', 'price' => 10, 'options_count' => 3], (object) ['group_id' => 'a', 'price' => 15, 'options_count' => 2], (object) ['group_id' => 'b', 'price' => 55, 'options_count' => 4], (object) ['group_id' => 'c', 'price' => 75, 'options_count' => 5], ]; $totals = []; foreach($items as $item) { $group_identifier = $item->group_id; @$totals[ $group_identifier ]['turnover'] += $item->price; @$totals[ $group_identifier ]['products']++; @$totals[ $group_identifier ]['options'] += $item->options_count; } var_dump($totals);

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.0150.00519.65
8.4.120.0080.00722.44
8.4.110.0130.00722.68
8.4.100.0150.00517.66
8.4.90.0110.01018.91
8.4.80.0060.00318.57
8.4.70.0100.00918.06
8.4.60.0160.00518.72
8.4.50.0060.00318.91
8.4.40.0110.00717.93
8.4.30.0070.01320.31
8.4.20.0060.00318.02
8.4.10.0090.00025.85
8.3.260.0130.00316.99
8.3.250.0100.00918.65
8.3.240.0110.00917.03
8.3.230.0110.00816.66
8.3.220.0060.00619.09
8.3.210.0040.00318.50
8.3.200.0020.00716.91
8.3.190.0050.00319.14
8.3.180.0100.00417.21
8.3.170.0110.00820.85
8.3.160.0120.00618.39
8.3.150.0130.00317.25
8.3.140.0120.00616.97
8.3.130.0160.00316.74
8.3.120.0130.00719.18
8.3.110.0060.00320.94
8.3.100.0060.00318.72
8.3.90.0090.00626.77
8.3.80.0030.00619.36
8.3.70.0070.00716.75
8.3.60.0070.00716.49
8.3.50.0100.00723.72
8.3.40.0160.00018.79
8.3.30.0090.00618.74
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.290.0100.00620.80
8.2.280.0060.00218.48
8.2.270.0130.00617.21
8.2.260.0150.00317.08
8.2.250.0000.00916.72
8.2.240.0040.00418.84
8.2.230.0120.00022.58
8.2.220.0100.00024.06
8.2.210.0080.00026.77
8.2.200.0030.00618.88
8.2.190.0060.00918.29
8.2.180.0130.00325.92
8.2.170.0120.00619.09
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00526.35
8.2.110.0030.00622.08
8.2.100.0030.00917.91
8.2.90.0080.00017.75
8.2.80.0040.00418.79
8.2.70.0000.00817.63
8.2.60.0000.00818.05
8.2.50.0030.00618.05
8.2.40.0000.00818.34
8.2.30.0060.00318.05
8.2.20.0040.00418.12
8.2.10.0050.00321.14
8.2.00.0000.00719.25
8.1.330.0130.00622.13
8.1.320.0100.01016.34
8.1.310.0060.01216.29
8.1.300.0040.00420.11
8.1.290.0050.00530.84
8.1.280.0110.00425.92
8.1.270.0000.00723.99
8.1.260.0050.00328.09
8.1.250.0080.00028.09
8.1.240.0060.00323.77
8.1.230.0090.00317.89
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0040.00417.22
8.1.180.0000.00818.10
8.1.170.0100.00019.02
8.1.160.0040.00418.86
8.1.150.0030.00718.88
8.1.140.0040.00418.77
8.1.130.0030.00320.19
8.1.120.0040.00417.45
8.1.110.0000.00717.46
8.1.100.0040.00417.51
8.1.90.0000.00717.48
8.1.80.0050.00317.55
8.1.70.0000.00717.46
8.1.60.0040.00417.65
8.1.50.0050.00317.54
8.1.40.0040.00417.44
8.1.30.0040.00417.71
8.1.20.0060.00317.57
8.1.10.0000.00717.48
8.1.00.0080.00317.56
8.0.300.0000.00718.92
8.0.290.0070.00016.75
8.0.280.0040.00418.36
8.0.270.0080.00018.08
8.0.260.0000.00618.38
8.0.250.0040.00417.03
8.0.240.0000.00717.02
8.0.230.0000.00817.08
8.0.220.0000.00716.96
8.0.210.0040.00416.96
8.0.200.0070.00017.01
8.0.190.0080.00016.91
8.0.180.0040.00416.95
8.0.170.0030.00516.99
8.0.160.0040.00416.98
8.0.150.0030.00616.98
8.0.140.0030.00716.96
8.0.130.0060.00013.48
8.0.120.0030.00516.99
8.0.110.0040.00416.93
8.0.100.0030.00616.86
8.0.90.0080.00016.86
8.0.80.0020.01216.94
8.0.70.0000.00816.79
8.0.60.0040.00416.88
8.0.50.0070.00016.79
8.0.30.0120.00617.34
8.0.20.0060.01217.29
8.0.10.0080.01117.23
8.0.00.0070.01817.11
7.4.330.0050.00016.62
7.4.320.0080.00016.54
7.4.300.0000.00616.52
7.4.290.0060.00316.52
7.4.280.0000.00816.59
7.4.270.0000.00716.43
7.4.260.0000.00613.27
7.4.250.0000.00716.55
7.4.240.0020.00516.61
7.4.230.0000.00716.62
7.4.220.0050.00216.68
7.4.210.0080.00716.65
7.4.200.0000.00816.41
7.4.140.0120.00616.63
7.4.130.0150.00316.50
7.4.120.0140.00416.32
7.4.110.0060.01216.61
7.4.100.0090.00916.53
7.4.90.0090.00916.25
7.4.80.0140.01016.51
7.4.70.0080.01216.75
7.4.60.0070.01016.45
7.4.50.0120.00616.42
7.4.40.0130.00416.39
7.4.30.0150.00416.71
7.4.20.0080.01116.52
7.4.10.0090.00916.33
7.4.00.0070.01316.53
7.3.330.0030.00616.31
7.3.320.0000.00613.20
7.3.310.0060.00316.36
7.3.300.0000.00716.51
7.3.290.0110.00816.39
7.3.260.0040.01516.43
7.3.250.0090.00916.32
7.3.240.0150.00416.41
7.3.230.0120.00616.43
7.3.220.0220.00016.39
7.3.210.0060.01316.29
7.3.200.0100.00716.47
7.3.190.0090.00916.55
7.3.180.0070.01016.55
7.3.170.0060.01216.61
7.3.160.0090.00916.43
7.3.150.0070.01016.50
7.3.140.0120.00616.45
7.3.130.0040.01516.39
7.3.120.0030.01716.41
7.3.110.0140.00716.55
7.3.100.0130.00616.53
7.3.90.0140.00316.36
7.3.80.0100.01016.38
7.3.70.0070.01116.21
7.3.60.0110.00816.52
7.3.50.0150.00916.44
7.3.40.0140.00616.21
7.3.30.0070.01416.27
7.3.20.0180.00016.34
7.3.10.0150.00616.32
7.3.00.0110.00816.36

preferences:
27.46 ms | 403 KiB | 5 Q