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)); }); }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [1] => Array ( [productID] => 11111 [size] => L [quantity] => 4 ) [2] => Array ( [productID] => 22222 [size] => S [quantity] => 3 ) [3] => Array ( [productID] => 22222 [size] => L [quantity] => 7 ) [4] => Array ( [productID] => 33333 [size] => M [quantity] => 1 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.98 ms | 1620 KiB | 4 Q