如何检查数组是在分开的数组中还是在同一个数组中

I have an array with 2 values (the outer part is the array the inner part are the values)

enter image description here

And then i have four other arrays with each containing 4 values:

enter image description here

Now what i basically want to check is: if the 2 values of the first array are in one of the four arrays together then do an action. so for example:

enter image description here

I also want to run a different action if the items are in separated arrays like this:

enter image description here

How can i do this?

For the first case, you could use array_intersect:

$arr = array('foo', 'bar');

$test1 = array('foo', 'bar', 'three', 'four');
$test2 = array('foo', 'two', 'three', 'four');
$test3 = array('one', 'bar', 'three', 'four');
$test4 = array('one', 'two', 'three', 'four');

$result = array_intersect($arr, $test1);
var_dump($result);

If the result count matches $arr, then you know both values from $arr are present in whichever test array you're comparing against. If that fails, then you can perform your second test using array_merge:

$merged = array_merge($test1, $test2, $test3, $test4);
$result = array_intersect($arr, $merged);

Again, if the result count matches $arr, then you know both values were found amongst the multiple arrays. If you want to know exactly which two (or more) arrays the values are in, then you could just compare two at a time within a loop that cycles through every permutation.

For the first case, you can do it like this:

$a = [1,2];

$b = [
    [1,2,3,4],
    [5,6,7,8],
    [9,2,1,2],
    [0,1,2,3]
];

foreach ($b as $arr) {
    $count = 0;

    foreach ($a as $outer_arr) {
        if(in_array($outer_arr, $arr))
            $count++;
    }

    if($count >= count($a)) {
        var_dump('yes');
    } else {
        var_dump('no');
    }
}

/* Output:
yes
no
yes
yes
*/

Hope this helps!