3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstArray = [ "1" => [ "MemberList" => [ "0" => 100, "1" => "5d6", "2" => "5d7", ], ], "3" => [ "MemberList" => [ "0" => "5d8", "1" => 200, ], ], ]; $secondArray = [ 0 => 100, 1 => 200, ]; function custom($firstArray, $secondArray) { foreach ($firstArray as $key => $value) { if (is_array($value)) { $firstArray[$key] = custom($value, $secondArray); }else{ if(in_array($value,$secondArray)){ unset($firstArray[$key]); } } } return $firstArray; } $new = custom($firstArray, $secondArray); print_r($new);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [1] => Array ( [MemberList] => Array ( [1] => 5d6 [2] => 5d7 ) ) [3] => Array ( [MemberList] => Array ( [0] => 5d8 ) ) )

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:
179.49 ms | 406 KiB | 5 Q