In_array for multidimentional array

//IN_ARRAY for multidimensional array           
function in_array_r($needle, $haystack, $strict = false) {
    foreach ($haystack as $item) {
        if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
            return true;
        }
    }

    return false;
}

Leave a Reply

Your email address will not be published. Required fields are marked *