0
更換空的空間,我有一個數組,看起來像這樣:在多維數組文本
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
我嘗試下面的代碼,但沒有成功:
foreach($members as $member)
{
foreach($member as $k => $v)
{
if($member[$k][$v] == null || trim($member[$k][$v]) == "")
{
$member[$k][$v] = "N/A";
}
}
}
@KristerAndersson這是一個有問題的拼寫錯誤 –