Can I and how can I use PHP's array_filter
to filter the blank/nulls entries out of the following array structure?
From: The array is from a PDO call using Fetch BOTH so the numeric and named values are always equal in this case.
Array
(
[2400] => Array
(
[0] => Array
(
[value] => 7
[0] => 7
)
[1] => Array
(
[value] => 61
[0] => 61
)
[2] => Array
(
[value] => 42
[0] => 42
)
[3] => Array
(
[value] =>
[0] =>
)
)
)
To:
Array
(
[2400] => Array
(
[0] => Array
(
[value] => 7
[0] => 7
)
[1] => Array
(
[value] => 61
[0] => 61
)
[2] => Array
(
[value] => 42
[0] => 42
)
)
)
I have tried
- plain old
array_filter
-
array_filter(array, function($f){ ??? })
and not quite sure where to go from here... I was going to foreach the array to delve into it but how will that affect the entries througharray_filter
? Won't a true/false return bring in the entire [2400] array portion? It just has me confused.
Please suggest improvements to the question