多维数组值与另一个索引数组值匹配,然后从 PHP 7 中的多维数组中删除值

multidimensional array values matched with another index array values then remove values from multidimensional in PHP 7

我有以下两个数组

    $firstArray = Array
(
    [1] => Array
        (
            [MemberList] => Array
                (
                    [0] => 100
                    [1] => 5d6
                    [2] => 5d7
                )
        )
    [3] => Array
        (
            [MemberList] => Array
                (
                    [0] => 5d8
                    [1] => 200
                )
        )
)


$secondArray = Array
(
    [0] => 100
    [1] => 200
)

我的问题是,如果假设 $secondArray 数组值与 $firstArray 数组匹配,那么我必须从 $firstArray

中删除这些值

my expected output

$firstArray = Array
(
    [1] => Array
        (
            [MemberList] => Array
                (
                    [0] => 5d6
                    [1] => 5d7
                )
        )
    [3] => Array
        (
            [MemberList] => Array
                (
                    [0] => 5d8
                )
        )
)
$newArray = array_map(
    function ($v) use ($secondArray) { 
        return ['MemberList' => array_diff($v['MemberList'], $secondArray)]; 
    }, 
    $firstArray
);

Fiddle here.