php判断二维数组中是否含有某个值

别等时光非礼了梦想. 提交于 2019-12-10 12:01:58
in_array — 检查数组中是否存在某个值.用递归来检验多维数组array(2) {
[0]=>
array(1) {
["bankcard"]=>
string(19) "6212260200176770626"
}
[1]=>
array(1) {
["bankcard"]=>
string(19) "6217002430037113726"
}
}$aa = 6217002430037113726;$att = $g_att;
public function deep_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($this->deep_in_array($value, $item)) {            return true;        }    }   return false;}


 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!