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