我有一个这样的数组:
Array
(
[206] => Array
(
[1] => Array
(
[formatid] => 1
[format] => CD
[formatseourl] => cd
)
)
[556] => Array
(
[] => Array
(
[formatid] =>
[format] =>
[formatseourl] =>
)
)
[413] => Array
(
[3] => Array
(
[formatid] => 3
[format] => CASETE
[formatseourl] => casete
)
)
)
...对于特定的键,我想获取值,但在我需要验证是否有值之前。代码已构建,但我不知道如何验证数组中是否有值...我尝试了 isset、empty、count、array_key_exists 没有成功...我知道我很接近...
$key = 556;
//if there are no formats in array, dont bother to create the ul
if (?????????formats exist in $array[$key]) { ?>
<ul><?php
foreach ($array[$key] as $value) { ?>
<li><?php echo $value['format']; ?></li><?php
} ?>
</ul><?php
} ?>