php判断多维数组是否存在某个值

admin 阅读:139 2024-03-02
  function find_in_array($value, $array) { 
            foreach($array as $item) { 
                if(!is_array($item)) { 
                    if ($item == $value) {
                        return true;
                    } else {
                        continue; 
                    }
                } 
                if(in_array($value, $item)) {
                    return true; 
                } else if(deep_in_array($value, $item)) {
                    return true; 
                }
            } 
            return false; 
    }

 

声明

1、部分文章来源于网络,仅作为参考。
2、如果网站中图片和文字侵犯了您的版权,请联系1943759704@qq.com处理!