Let’s take this array as an example:
$arr = array(
'foo' => 'foo',
'bar' => array(
'baz' => 'baz',
'candy' => 'candy',
'vegetable' => array(
'carrot' => 'carrot',
)
),
'vegetable' => array(
'carrot' => 'carrot2',
),
'fruits' => 'fruits',
);
Now how to do a general search to check if a value exists whether as a key or a value in the array and his sub-arrays.
I think we may use a double control
multi_array_key_exists function:
Source: http://www.php.net/manual/en/function.array-key-exists.php#92355
deep_in_array function:
Source: php Checking if value exists in array of array