3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cart = [ [ 'productID' => '11111' , 'size' => 'M' , 'quantity' => 2 ], [ 'productID' => '11111' , 'size' => 'L' , 'quantity' => 4 ], [ 'productID' => '22222' , 'size' => 'S' , 'quantity' => 3 ], [ 'productID' => '22222' , 'size' => 'L' , 'quantity' => 7 ], [ 'productID' => '33333' , 'size' => 'M' , 'quantity' => 1 ] ]; $r = removeElementFromArray( $cart , [ 'productID' => '11111' , 'size' => 'M' ] ); print_r($r); function removeElementFromArray($targetArray, $needles) { return array_filter($targetArray, function ($item) use ($needles) { return !empty(array_diff_assoc($needles, $item)); }); }

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.30.0110.00717.29
8.5.20.0040.00419.36
8.5.10.0110.00616.61
8.5.00.0130.00819.81
8.4.180.0110.01119.45
8.4.170.0100.01223.86
8.4.160.0160.00919.71
8.4.150.0080.00616.81
8.4.140.0080.01217.39
8.4.130.0140.00717.52
8.4.120.0140.00520.47
8.4.110.0120.00917.80
8.4.100.0070.00319.01
8.4.90.0090.01022.33
8.4.80.0040.00518.61
8.4.70.0140.00918.07
8.4.60.0150.00718.54
8.4.50.0120.00720.37
8.4.40.0110.00817.81
8.4.30.0130.00718.52
8.4.20.0080.00817.85
8.4.10.0120.00620.81
8.3.300.0120.00720.71
8.3.290.0130.00718.51
8.3.280.0140.00820.90
8.3.270.0070.00416.36
8.3.260.0160.00516.56
8.3.250.0110.00718.83
8.3.240.0100.00718.72
8.3.230.0120.01016.73
8.3.220.0150.00318.95
8.3.210.0080.01018.58
8.3.200.0050.00416.32
8.3.190.0100.00817.29
8.3.180.0030.00616.35
8.3.170.0110.00817.02
8.3.160.0110.00420.11
8.3.150.0100.01016.75
8.3.140.0080.00016.55
8.3.130.0070.01118.40
8.3.120.0060.00319.04
8.3.110.0040.00720.94
8.3.100.0070.00424.06
8.3.90.0080.00018.30
8.3.80.0030.00619.36
8.3.70.0070.00718.43
8.3.60.0140.00718.07
8.3.50.0120.00824.40
8.3.40.0160.00618.51
8.3.30.0120.00319.22
8.3.20.0000.00724.18
8.3.10.0050.00224.66
8.3.00.0000.00826.16
8.2.300.0130.00718.09
8.2.290.0110.00820.68
8.2.280.0090.00518.61
8.2.270.0060.01316.88
8.2.260.0030.00616.52
8.2.250.0030.00616.57
8.2.240.0110.00817.02
8.2.230.0060.00322.58
8.2.220.0060.00937.54
8.2.210.0160.00326.77
8.2.200.0090.00018.88
8.2.190.0110.00416.63
8.2.180.0070.00725.92
8.2.170.0110.00422.96
8.2.160.0140.00022.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00226.35
8.2.110.0100.00019.09
8.2.100.0100.00317.75
8.2.90.0090.00317.50
8.2.80.0000.00818.61
8.2.70.0060.00317.63
8.2.60.0030.00517.80
8.2.50.0000.00818.07
8.2.40.0000.00718.35
8.2.30.0000.00818.08
8.2.20.0030.00318.07
8.2.10.0040.00419.32
8.2.00.0000.00719.22
8.1.340.0090.01217.48
8.1.330.0120.00822.16
8.1.320.0120.00817.86
8.1.310.0080.00018.53
8.1.300.0030.00518.67
8.1.290.0060.00330.84
8.1.280.0090.01225.92
8.1.270.0120.00323.80
8.1.260.0030.00528.09
8.1.250.0040.00428.09
8.1.240.0030.00620.90
8.1.230.0060.00617.64
8.1.220.0070.00017.74
8.1.210.0030.00618.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0050.00318.91
8.1.160.0070.00018.80
8.1.150.0030.00518.86
8.1.140.0030.00618.78
8.1.130.0000.00718.96
8.1.120.0060.00317.50
8.1.110.0040.00417.45
8.1.100.0050.00317.49
8.1.90.0080.00017.48
8.1.80.0000.00717.35
8.1.70.0030.00317.47
8.1.60.0000.00717.50
8.1.50.0030.00517.54
8.1.40.0080.00017.56
8.1.30.0030.00617.55
8.1.20.0000.00817.50
8.1.10.0040.00417.59
8.1.00.0040.00417.47
8.0.300.0070.00018.77
8.0.290.0030.00616.75
8.0.280.0050.00318.47
8.0.270.0070.00018.05
8.0.260.0040.00418.37
8.0.250.0030.00316.86
8.0.240.0000.00616.89
8.0.230.0040.00416.84
8.0.220.0060.00316.90
8.0.210.0000.00716.94
8.0.200.0040.00416.98
8.0.190.0000.00716.96
8.0.180.0000.00816.85
8.0.170.0000.00816.83
8.0.160.0070.00016.91
8.0.150.0040.00416.84
8.0.140.0040.00416.87
8.0.130.0000.00613.38
8.0.120.0050.00316.75
8.0.110.0030.00616.70
8.0.100.0040.00416.77
8.0.90.0030.00616.70
8.0.80.0050.01016.88
8.0.70.0030.00516.97
8.0.60.0040.00416.97
8.0.50.0000.00716.94
8.0.30.0120.00616.89
8.0.20.0190.00017.01
8.0.10.0030.00417.05
8.0.00.0150.00317.00
7.4.330.0000.00515.55
7.4.320.0040.00416.52
7.4.300.0000.00616.52
7.4.290.0000.00616.53
7.4.280.0070.00316.51
7.4.270.0000.00716.44
7.4.260.0000.00513.16
7.4.250.0030.00316.48
7.4.240.0000.00716.50
7.4.230.0050.00216.64
7.4.220.0020.00616.43
7.4.210.0020.01116.65
7.4.200.0030.00516.62
7.4.130.0170.00316.51
7.4.120.0150.00316.61
7.4.110.0090.00916.58
7.4.100.0030.01316.61
7.4.90.0140.00316.55
7.4.80.0190.00719.39
7.4.70.0130.00316.70
7.4.60.0150.00616.52
7.4.50.0090.00916.32
7.4.40.0090.00916.14
7.4.30.0150.00616.39
7.4.20.0070.01016.39
7.4.10.0120.00916.34
7.4.00.0160.00316.51
7.3.330.0030.00316.14
7.3.320.0050.00013.36
7.3.310.0070.00016.20
7.3.300.0020.00516.31
7.3.290.0090.00416.24
7.3.280.0040.01116.24
7.3.260.0190.00416.54
7.3.240.0090.00916.55
7.3.230.0070.01016.46
7.3.210.0080.00816.42
7.3.200.0130.00916.39
7.3.190.0080.00716.52
7.3.180.0100.00716.26
7.3.170.0180.00416.32
7.3.160.0100.01016.50
7.3.150.0090.00916.30
7.3.140.0040.01516.28
7.3.130.0030.01616.35
7.3.120.0130.00616.37
7.3.110.0060.01216.41
7.3.100.0090.00916.50
7.3.90.0140.00716.34
7.3.80.0030.01516.16
7.3.70.0100.01016.36
7.3.60.0200.00316.30
7.3.50.0100.00716.29
7.3.40.0100.00716.23
7.3.30.0110.00616.17
7.3.20.0220.00916.52
7.3.10.0040.01516.28
7.3.00.0070.01116.34
7.2.330.0150.00316.61
7.2.320.0100.00716.62
7.2.310.0030.01316.80
7.2.300.0030.01416.75
7.2.290.0140.00516.44
7.2.280.0170.00316.57
7.2.270.0180.00016.28
7.2.260.0150.00316.38
7.2.250.0100.01016.67
7.2.240.0110.00816.41
7.2.230.0100.00816.63
7.2.220.0060.01216.55
7.2.210.0000.01916.54
7.2.200.0130.01016.63
7.2.190.0060.01416.46
7.2.180.0070.01316.31
7.2.170.0060.01316.46
7.2.160.0140.00316.43
7.2.150.0100.01016.70
7.2.140.0100.01016.55
7.2.130.0070.01116.59
7.2.120.0030.01416.51
7.2.110.0060.01216.68
7.2.100.0100.01016.82
7.2.90.0080.01216.54
7.2.80.0080.01416.51
7.2.70.0310.00916.70
7.2.60.0060.01316.64
7.2.50.0170.00716.09
7.2.40.0150.00716.65
7.2.30.0140.00516.57
7.2.20.0120.01216.43
7.2.10.0160.00616.55
7.2.00.0060.01416.64

preferences:
50.27 ms | 1619 KiB | 5 Q