i have array like this
<?php $array = array ( array ( 0 => 1, 1 => 'php', 2 => 11, 3 => 11, 4 => 11, 5 => 11, 6 => 11, ), array ( 0 => 1, 1 => 'php', 2 => 11, 3 => 11, 4 => 11, 5 => 11, 6 => , ), );
and i want to search in this multi-array to find if the key [6] => is empty.if it was empty in any array return false so how to do this
foreach($array as $item) { foreach($item as $key=>$value) { print($key); if($key=="6" && $value==NULL) { echo "found"; return false; }else{ echo "not found"; return true; } } }
Advertisement
Answer
$empty = false; foreach($array as $item) { if(empty($item[6])) { $empty=true; break; } } return $empty;