我的多维数组如下所示:
Array
(
[0] => Array
(
[0] => 2010-12-03
[1] => 0
[2] => Array
(
[0] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[1] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[2] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[3] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[4] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[5] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
)
)
[1] => Array
(
[0] => 2010-12-10
[1] => 486
[2] => Array
(
[0] => Array
(
[0] => Bob
[1] => Lucy
[2] => 54
[3] => Y
[4] => PC1Clean
)
[1] => Array
(
[0] => Jo
[1] => Mary
[2] => 432
[3] => Y
[4] => PC2Bar
)
[2] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[3] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[4] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
[5] => Array
(
[0] =>
[1] =>
[2] => 0
[3] =>
[4] =>
)
)
)
我已经尝试过array_filter
不同的循环迭代来删除zero
/null
值,例如
function removeElementWithValue($array, $key, $value) {
foreach($array as $subKey => $subArray) {
if($subArray[$key] == $value) {
unset($array[$subKey]);
}
}
}
但似乎没有任何效果。任何帮助将非常感激!