function in_arrayr($needle, $haystack) { foreach ($haystack as $v) { if ($needle == $v) { return true; } elseif (is_array($v)) { if (in_arrayr($needle, $v) === true) { return true; } } } return false; }
function in_arrayr($needle, $haystack, $strict = false) { foreach ($haystack as $item) { if (($strict ? $item === $needle : $item == $needle) || is_array($item) && in_arrayr($needle, $item, $strict)) { return true; } } return false; }