Skip to content

Tag: array-filter

PHP Array_filter on “simple” multi-level array

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. To: I have tried plain old array_filter array_filter(array, function($f){ …

How to run array_filter recursively in a PHP array?

Given the following array $mm When I run count(array_filter($mm)) I get 3 as result since it is not recursive. count(array_filter($mm), COUNT_RECURSIVE) also will not do because I actually need to run the array_filter recursively, and then count its result. So my question is: how do I recursively run array_fi…