3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['id' => 1, 'product_id' => 4, 'product_number' => 10, 'moving_type' => 1], ['id' => 1, 'product_id' => 5, 'product_number' => 10, 'moving_type' => 1], ['id' => 1, 'product_id' => 5, 'product_number' => 2, 'moving_type' => 2] ]; foreach ($array as $row) { if (!isset($result[$row['product_id']])) { $result[$row['product_id']] = array_slice($row, 0, 3, true); } else { $result[$row['product_id']]['product_number'] += ($row['moving_type'] == 1 ? 1 : -1) * $row['product_number']; } } var_export(array_values($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.10.0070.01216.74
8.5.00.0160.00620.04
8.4.150.0020.00014.05
8.4.140.0150.00717.64
8.4.130.0140.00717.57
8.4.120.0120.00720.58
8.4.110.0090.01122.28
8.4.100.0120.00917.66
8.4.90.0130.00818.38
8.4.80.0060.00417.94
8.4.70.0090.00418.02
8.4.60.0040.00418.69
8.4.50.0130.00621.80
8.4.40.0080.00017.73
8.4.30.0070.01419.75
8.4.20.0030.01019.32
8.4.10.0040.00717.96
8.3.280.0190.00818.35
8.3.270.0100.01016.69
8.3.260.0130.00616.69
8.3.250.0130.00519.21
8.3.240.0110.00816.73
8.3.230.0130.00616.54
8.3.220.0130.00517.09
8.3.210.0050.00318.53
8.3.200.0110.00416.73
8.3.190.0040.00419.02
8.3.180.0090.00916.48
8.3.170.0160.00318.68
8.3.160.0110.00716.46
8.3.150.0110.00717.29
8.3.140.0120.00616.72
8.3.130.0000.00818.42
8.3.120.0050.00519.16
8.3.110.0090.00620.94
8.3.100.0070.00416.78
8.3.90.0000.00818.41
8.3.80.0060.00317.97
8.3.70.0150.00016.63
8.3.60.0170.00318.56
8.3.50.0040.01018.09
8.3.40.0120.00318.65
8.3.30.0070.00718.88
8.3.20.0060.00321.57
8.3.10.0000.00821.60
8.3.00.0050.00323.56
8.2.290.0040.00420.28
8.2.280.0020.00818.50
8.2.270.0070.01117.28
8.2.260.0040.00420.18
8.2.250.0090.01216.46
8.2.240.0090.00018.83
8.2.230.0080.00022.58
8.2.220.0030.00524.06
8.2.210.0050.00326.77
8.2.200.0030.00718.54
8.2.190.0100.01018.29
8.2.180.0140.00416.75
8.2.170.0040.01122.96
8.2.160.0110.00420.00
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00421.00
8.2.120.0000.00826.35
8.2.110.0030.00622.29
8.2.100.0000.01217.91
8.2.90.0000.00818.03
8.2.80.0040.00419.29
8.2.70.0080.00018.04
8.2.60.0000.00818.05
8.2.50.0040.00418.10
8.2.40.0040.00419.22
8.2.30.0030.00521.02
8.2.20.0040.00418.00
8.2.10.0000.00718.11
8.2.00.0030.00619.19
8.1.330.0120.00723.78
8.1.320.0110.00816.13
8.1.310.0030.00616.80
8.1.300.0060.00320.31
8.1.290.0000.00918.88
8.1.280.0110.00725.92
8.1.270.0080.00023.96
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0090.00023.98
8.1.230.0120.00320.90
8.1.220.0030.00617.77
8.1.210.0000.00818.97
8.1.200.0040.00417.35
8.1.190.0030.00617.25
8.1.180.0000.00818.10
8.1.170.0060.00318.59
8.1.160.0000.00718.85
8.1.150.0000.00719.03
8.1.140.0030.00517.61
8.1.130.0000.00819.02
8.1.120.0050.00217.39
8.1.110.0080.00017.48
8.1.100.0000.00717.46
8.1.90.0000.00817.38
8.1.80.0000.00917.44
8.1.70.0000.00817.51
8.1.60.0040.00417.54
8.1.50.0040.00817.50
8.1.40.0050.00317.58
8.1.30.0050.00317.48
8.1.20.0000.00817.65
8.1.10.0000.00717.57
8.1.00.0030.00617.53
8.0.300.0000.00920.14
8.0.290.0040.00416.63
8.0.280.0070.00018.36
8.0.270.0070.00017.27
8.0.260.0030.00317.29
8.0.250.0060.00016.84
8.0.240.0040.00416.91
8.0.230.0070.00016.87
8.0.220.0030.00316.88
8.0.210.0000.00616.89
8.0.200.0040.00416.89
8.0.190.0050.00316.85
8.0.180.0080.00016.92
8.0.170.0040.00416.91
8.0.160.0000.00816.92
8.0.150.0020.00516.91
8.0.140.0070.00016.86
8.0.130.0060.00013.36
8.0.120.0000.00716.87
8.0.110.0040.00416.83
8.0.100.0050.00216.80
8.0.90.0040.00417.00
8.0.80.0110.00316.89
8.0.70.0040.00416.89
8.0.60.0040.00416.92
8.0.50.0020.00516.80
8.0.30.0090.01217.01
8.0.20.0080.01017.40
8.0.10.0060.00317.06
8.0.00.0090.01316.76
7.4.330.0030.00316.77
7.4.320.0060.00016.40
7.4.300.0000.00616.66
7.4.290.0000.00716.65
7.4.280.0030.00516.46
7.4.270.0000.00716.63
7.4.260.0030.00616.59
7.4.250.0050.00316.37
7.4.240.0000.00716.68
7.4.230.0000.00716.34
7.4.220.0000.00816.26
7.4.210.0080.00916.61
7.4.200.0020.00516.51
7.4.160.0120.00516.61
7.4.140.0090.00917.86
7.4.130.0100.00716.47
7.4.120.0090.00916.57
7.4.110.0120.00916.78
7.4.100.0100.00716.73
7.4.90.0060.00916.72
7.4.80.0140.00319.39
7.4.70.0060.01216.49
7.4.60.0090.00616.29
7.4.50.0130.00316.46
7.4.40.0100.00716.30
7.4.00.0060.00714.95
7.3.330.0000.00613.22
7.3.320.0060.00013.27
7.3.310.0030.00316.18
7.3.300.0050.00316.29
7.3.290.0060.00916.22
7.3.280.0140.00916.34
7.3.260.0100.00816.34
7.3.240.0090.00816.42
7.3.230.0090.01616.30
7.3.210.0030.01316.42
7.3.200.0090.00916.52
7.3.190.0090.00916.33
7.3.180.0060.01216.50
7.3.170.0040.01116.46
7.3.160.0060.00916.46
7.3.120.0000.01514.79
7.3.110.0060.01314.96
7.3.100.0090.00614.61
7.3.90.0060.00614.93
7.3.80.0070.01114.73
7.3.70.0070.01114.60
7.3.60.0070.00714.98
7.3.50.0030.00614.62
7.3.40.0060.00914.98
7.3.30.0030.01014.90
7.3.20.0060.00916.78
7.3.10.0100.00616.49
7.3.00.0070.00916.69
7.2.330.0070.01016.82
7.2.320.0150.00916.46
7.2.310.0160.01016.82
7.2.300.0120.01216.67
7.2.290.0150.00416.62
7.2.250.0080.00415.25
7.2.240.0160.00315.28
7.2.230.0090.00615.09
7.2.220.0000.01314.95
7.2.210.0070.01015.26
7.2.200.0060.01215.03
7.2.190.0030.00915.07
7.2.180.0030.00815.02
7.2.170.0070.01015.10
7.2.130.0100.00616.91
7.2.120.0060.00916.91
7.2.110.0060.00616.90
7.2.100.0060.00916.59
7.2.90.0000.01417.04
7.2.80.0000.01616.62
7.2.70.0110.00316.82
7.2.60.0060.00916.70
7.2.50.0090.00617.09
7.2.40.1220.00717.27
7.2.30.0800.00617.46
7.2.20.0100.01117.30
7.2.10.1030.00917.53
7.2.00.1470.01117.54
7.1.330.0070.00715.61
7.1.320.0000.01415.84
7.1.310.0100.00715.89
7.1.300.0040.01115.75
7.1.290.0090.00616.00
7.1.280.0040.00415.63
7.1.270.0030.01015.71
7.1.260.0060.00315.65
7.1.250.0060.00415.86
7.1.200.0040.00715.70
7.1.160.2610.01316.85
7.1.150.2060.01016.63
7.1.140.2600.00816.54
7.1.130.1560.01016.74
7.1.120.1620.00616.77
7.1.110.2150.01016.00
7.1.100.1500.00815.80
7.1.90.3740.00816.14
7.1.80.4860.00516.20
7.1.70.2020.00715.50
7.1.60.4490.01433.33
7.1.50.4570.01133.04
7.1.40.4660.01432.61
7.1.30.4120.01532.59
7.1.20.2700.01232.65
7.1.10.2470.01615.00
7.1.00.1720.01014.75

preferences:
165.66 ms | 403 KiB | 5 Q