3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = array( array('idproduct' => 1, 'amount' => 5), array('idproduct' => 2, 'amount' => 10), array('idproduct' => 3, 'amount' => 11), array('idproduct' => 4, 'amount' => 5) ); addOrOverride($products, array('idproduct' => 4, 'amount' => 6)); function addOrOverride(&$arr, $newItem) { $filtered = array_filter($arr, function($item) use($newItem) { return $item['idproduct'] == $newItem['idproduct']; }); if(count($filtered) > 0) { $key = key($filtered); $arr[$key] = array_merge($arr[$key], $newItem); } else { $arr[] = $newItem; } }

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.0070.01318.55
8.3.50.0100.00621.15
8.3.40.0110.00418.80
8.3.30.0100.00618.71
8.3.20.0080.00018.92
8.3.10.0080.00020.52
8.3.00.0030.00817.63
8.2.180.0140.00716.36
8.2.170.0140.00722.96
8.2.160.0100.00322.17
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0030.00526.16
8.2.120.0060.00319.89
8.2.110.0030.00621.03
8.2.100.0030.00917.91
8.2.90.0040.00419.17
8.2.80.0060.00317.97
8.2.70.0040.00417.75
8.2.60.0080.00018.16
8.2.50.0080.00018.07
8.2.40.0060.00318.28
8.2.30.0050.00319.93
8.2.20.0050.00217.86
8.2.10.0040.00417.76
8.2.00.0090.00017.69
8.1.270.0040.00423.99
8.1.260.0130.00326.35
8.1.250.0070.00028.09
8.1.240.0100.00022.60
8.1.230.0000.01120.85
8.1.220.0000.00818.77
8.1.210.0040.00418.77
8.1.200.0090.00017.38
8.1.190.0060.00317.53
8.1.180.0040.00418.10
8.1.170.0090.00018.95
8.1.160.0050.00218.93
8.1.150.0000.00818.59
8.1.140.0000.00717.36
8.1.130.0000.00717.75
8.1.120.0070.00017.47
8.1.110.0080.00017.42
8.1.100.0040.00417.44
8.1.90.0000.00717.41
8.1.80.0000.00717.46
8.1.70.0000.00717.46
8.1.60.0000.00817.64
8.1.50.0050.00217.51
8.1.40.0080.00017.41
8.1.30.0040.00417.55
8.1.20.0080.00017.68
8.1.10.0080.00017.52
8.1.00.0040.00417.50
8.0.300.0050.00219.90
8.0.290.0060.00616.63
8.0.280.0040.00418.35
8.0.270.0030.00317.22
8.0.260.0000.00716.73
8.0.250.0070.00016.93
8.0.240.0000.00816.96
8.0.230.0030.00316.86
8.0.220.0050.00516.83
8.0.210.0000.00816.95
8.0.200.0030.00316.99
8.0.190.0080.00016.79
8.0.180.0070.00016.93
8.0.170.0000.00916.85
8.0.160.0040.00416.77
8.0.150.0040.00716.82
8.0.140.0080.00416.90
8.0.130.0000.00513.35
8.0.120.0030.00516.88
8.0.110.0000.00916.75
8.0.100.0000.00816.94
8.0.90.0050.00217.00
8.0.80.0090.00916.80
8.0.70.0000.00716.78
8.0.60.0000.00716.82
8.0.50.0050.00316.73
8.0.30.0140.00817.12
8.0.20.0100.01117.40
8.0.10.0040.00416.98
8.0.00.0090.00916.99
7.4.330.0030.00313.43
7.4.320.0000.00616.53
7.4.300.0000.00716.50
7.4.290.0000.00716.50
7.4.280.0030.00316.43
7.4.270.0030.00316.64
7.4.260.0030.00313.23
7.4.250.0080.00016.48
7.4.240.0000.00716.47
7.4.230.0000.00716.57
7.4.220.0070.01316.44
7.4.210.0070.00816.54
7.4.200.0000.00716.58
7.4.190.0040.00416.41
7.4.160.0190.00316.47
7.4.150.0070.01017.40
7.4.140.0120.00817.21
7.4.130.0090.00816.42
7.4.120.0080.00816.45
7.4.110.0050.01316.52
7.4.100.0090.01016.68
7.4.90.0030.01316.34
7.4.80.0060.01619.03
7.4.70.0090.00916.30
7.4.60.0080.00816.39
7.4.50.0060.00316.51
7.4.40.0030.01322.27
7.4.30.0090.00916.57
7.4.00.0000.00814.91
7.3.330.0030.00313.32
7.3.320.0030.00313.19
7.3.310.0060.00016.36
7.3.300.0030.00316.37
7.3.290.0000.01416.26
7.3.280.0100.00616.35
7.3.270.0090.00917.40
7.3.260.0090.00918.24
7.3.250.0090.01116.45
7.3.240.0130.00316.61
7.3.230.0120.00416.39
7.3.210.0070.01016.29
7.3.200.0060.01519.39
7.3.190.0060.01116.37
7.3.180.0030.01316.29
7.3.170.0130.00316.38
7.3.160.0040.01416.47
7.3.120.0070.00714.66
7.3.110.0030.01414.77
7.3.100.0100.00614.78
7.3.90.0030.00914.91
7.3.80.0000.00814.83
7.3.70.0040.01115.00
7.3.60.0040.00414.63
7.3.50.0030.00915.01
7.3.40.0120.00314.88
7.3.30.0080.00414.55
7.3.20.0000.01516.70
7.3.10.0060.00916.63
7.3.00.0070.00716.55
7.2.330.0110.00716.69
7.2.320.0090.01216.42
7.2.310.0160.00616.62
7.2.300.0090.01216.49
7.2.290.0130.00316.75
7.2.240.0110.00715.07
7.2.230.0040.01114.88
7.2.220.0000.01314.61
7.2.210.0000.01515.11
7.2.200.0070.00415.18
7.2.190.0030.01014.95
7.2.180.0030.01315.16
7.2.170.0080.00415.04
7.2.160.0080.00814.93
7.2.150.0170.00016.90
7.2.140.0000.01117.18
7.2.130.0100.00316.96
7.2.120.0080.00416.94
7.2.110.0090.00617.05
7.2.100.0000.01416.84
7.2.90.0040.01116.86
7.2.80.0060.00916.72
7.2.70.0030.01016.93
7.2.60.0060.00316.79
7.2.50.0060.00816.97
7.2.40.0090.00917.01
7.2.30.0030.00716.95
7.2.20.0120.00316.95
7.2.10.0080.00616.62
7.2.00.0000.00917.00
7.1.330.0110.00715.75
7.1.320.0100.00615.73
7.1.310.0000.01215.95
7.1.300.0070.00715.96
7.1.290.0040.00715.55
7.1.280.0000.01115.86
7.1.270.0060.00616.04
7.1.260.0110.00016.05
7.1.250.0040.01215.91
7.1.70.0000.01017.07
7.1.60.0070.01319.40
7.1.50.0070.00417.05
7.1.00.0000.04022.47
7.0.200.0440.00016.57
7.0.140.0030.07321.98
7.0.60.0100.08319.86
7.0.50.0100.03717.85
7.0.40.0070.05017.77
7.0.30.0100.05317.73
7.0.20.0070.08717.76
7.0.10.0030.06017.75
7.0.00.0030.04317.68
5.6.280.0100.06021.12
5.6.210.0030.08720.70
5.6.200.0030.07318.18
5.6.190.0000.08718.20
5.6.180.0100.08018.19
5.6.170.0130.07718.19
5.6.160.0170.07018.22
5.6.150.0130.05718.19
5.6.140.0070.08318.19
5.6.130.0030.08318.15
5.6.120.0030.06018.17
5.6.110.0100.07318.22
5.6.100.0070.06718.14
5.6.90.0130.07318.16
5.6.80.0030.08017.56
5.6.70.0070.05717.57
5.6.60.0070.05317.66
5.6.50.0030.06017.59
5.6.40.0100.05717.52
5.6.30.0070.08017.48
5.6.20.0170.06717.50
5.6.10.0030.07317.50
5.6.00.0030.08017.62
5.5.350.0130.07320.39
5.5.340.0030.05018.05
5.5.330.0030.06018.04
5.5.320.0100.06317.94
5.5.310.0000.06017.98
5.5.300.0100.07017.92
5.5.290.0100.07717.94
5.5.280.0130.06318.04
5.5.270.0000.07018.03
5.5.260.0100.05717.97
5.5.250.0070.04017.77
5.5.240.0030.06717.33
5.5.230.0130.07017.42
5.5.220.0000.05317.35
5.5.210.0070.08017.37
5.5.200.0130.07317.34
5.5.190.0070.04717.32
5.5.180.0070.08017.34
5.5.160.0130.06717.43
5.5.150.0000.04717.31
5.5.140.0170.07017.29
5.5.130.0070.04717.39
5.5.120.0030.07317.34
5.5.110.0100.06017.32
5.5.100.0030.05017.23
5.5.90.0070.05717.24
5.5.80.0100.03317.21
5.5.70.0100.07017.19
5.5.60.0130.05317.33
5.5.50.0130.07017.20
5.5.40.0030.07317.32
5.5.30.0070.08017.30
5.5.20.0070.05017.18
5.5.10.0070.07317.16
5.5.00.0070.06717.18
5.4.450.0130.07719.45
5.4.440.0100.07719.37
5.4.430.0070.03719.36
5.4.420.0100.05719.22
5.4.410.0000.05019.29
5.4.400.0070.07719.13
5.4.390.0070.03719.05
5.4.380.0130.06319.05
5.4.370.0130.07019.05
5.4.360.0070.07719.01
5.4.350.0100.07319.09
5.4.340.0170.06719.09
5.4.320.0070.08019.09
5.4.310.0070.04719.05
5.4.300.0070.08319.01
5.4.290.0200.06319.11
5.4.280.0070.07019.11
5.4.270.0070.06719.12
5.4.260.0070.07319.05
5.4.250.0170.06718.94
5.4.240.0030.06718.97
5.4.230.0130.07019.00
5.4.220.0000.05019.04
5.4.210.0070.07019.00
5.4.200.0070.06019.11
5.4.190.0100.07718.88
5.4.180.0070.07318.94
5.4.170.0170.07319.03
5.4.160.0000.08019.01
5.4.150.0100.07319.02
5.4.140.0070.04316.44
5.4.130.0100.07016.46
5.4.120.0030.06716.47
5.4.110.0070.07316.61
5.4.100.0030.05716.47
5.4.90.0030.05716.48
5.4.80.0100.05716.46
5.4.70.0000.08016.51
5.4.60.0100.06716.38
5.4.50.0100.06716.32
5.4.40.0130.06316.41
5.4.30.0100.07316.35
5.4.20.0030.07716.20
5.4.10.0130.06716.42
5.4.00.0030.04315.87
5.3.290.0000.08014.66
5.3.280.0100.07314.61
5.3.270.0100.07714.57
5.3.260.0000.08314.65
5.3.250.0200.06314.58
5.3.240.0170.06314.66
5.3.230.0100.07714.66
5.3.220.0030.04714.54
5.3.210.0100.07014.57
5.3.200.0070.04714.59
5.3.190.0100.07314.68
5.3.180.0070.07714.64
5.3.170.0070.07714.65
5.3.160.0070.05314.63
5.3.150.0100.03714.63
5.3.140.0070.07314.42
5.3.130.0100.03314.58
5.3.120.0070.03714.60
5.3.110.0070.08014.61
5.3.100.0030.06014.05
5.3.90.0030.03714.02
5.3.80.0070.05013.88
5.3.70.0100.07014.02
5.3.60.0030.07014.02
5.3.50.0100.05313.84
5.3.40.0130.06713.94
5.3.30.0070.06313.82
5.3.20.0070.04313.74
5.3.10.0070.03313.66
5.3.00.0000.04013.64
5.2.170.0070.05011.21
5.2.160.0030.06711.16
5.2.150.0070.06311.15
5.2.140.0030.06311.24
5.2.130.0000.04011.18
5.2.120.0070.04011.21
5.2.110.0000.03011.14
5.2.100.0130.05011.16
5.2.90.0070.02711.00
5.2.80.0070.06711.10
5.2.70.0030.05711.14
5.2.60.0070.06011.04
5.2.50.0030.03311.03
5.2.40.0070.03010.84
5.2.30.0100.05710.97
5.2.20.0070.03711.05
5.2.10.0030.05310.81
5.2.00.0070.05710.76
5.1.60.0030.0309.97
5.1.50.0000.06010.02
5.1.40.0100.04310.05
5.1.30.0030.03710.32
5.1.20.0000.04010.40
5.1.10.0100.05010.05
5.1.00.0070.03010.13
5.0.50.0030.0378.76
5.0.40.0000.0408.44
5.0.30.0030.0538.20
5.0.20.0000.0408.18
5.0.10.0070.0378.21
5.0.00.0000.0438.13
4.4.90.0030.0177.57
4.4.80.0000.0207.57
4.4.70.0000.0377.57
4.4.60.0000.0307.57
4.4.50.0000.0377.57
4.4.40.0000.0377.57
4.4.30.0030.0337.57
4.4.20.0000.0177.57
4.4.10.0070.0307.57
4.4.00.0000.0507.57
4.3.110.0030.0137.57
4.3.100.0000.0307.57
4.3.90.0030.0307.57
4.3.80.0030.0507.57
4.3.70.0000.0237.57
4.3.60.0000.0237.57
4.3.50.0030.0177.57
4.3.40.0000.0507.57
4.3.30.0030.0377.57
4.3.20.0030.0307.57
4.3.10.0000.0337.57
4.3.00.0000.0377.57

preferences:
70.69 ms | 400 KiB | 5 Q