我有陣列這樣如何找到空值在多維數組特定鍵
<?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 => ,
),
);
,我想在此多陣列搜索找到如果鍵[6] =>是empty.if它是空的任何數組的形式返回false,所以如何做到這一點
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;
}
}
}
看看[此](HTTPS ://gist.github.com/rianrainey/4263778) – Naruto 2015-02-24 15:16:27
看看這個http://php.net/manual/en/function.empty.php – kya 2015-02-24 15:16:31
你寫的是什麼問題? – Styphon 2015-02-24 15:18:15