我有一个看起来像这样的数组:
Array
(
[0] => Array
(
[id] => 1
[firstname] => Firstname one
[lastname] => Lastname one
)
[1] => Array
(
[id] => 2
[firstname] => Firstname two
[lastname] => Lastname two
)
[2] => Array
(
[id] => 3
[firstname] => Firstname three
[lastname] => Lastname three
)
)
我想遍历数组并用N/A 之类的东西替换每个空白空间或 null
我尝试了下面的代码但没有成功:
foreach($members as $member)
{
foreach($member as $k => $v)
{
if($member[$k][$v] == null || trim($member[$k][$v]) == "")
{
$member[$k][$v] = "N/A";
}
}
}