function array_search_recursive($needle, array $haystack, $strict = false, &$map = []) {
foreach ($haystack as $key => $value) {
if (is_array($value) && array_search_recursive($needle, $value, $strict, $map)) {
$map[] = $key;
return true;
}
if ($strict && ($needle === $value)) {
$map[] = $key;
return true;
}
if (!$strict && ($needle == $value)) {
$map[] = $key;