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


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;
}
 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM