Count “truthy” values in a 2d array
From the PHP array_filter documentation: //This function filters an array and remove all null values recursively. <?php function array_filter_recursive($input) { foreach ($input as &$value) { if (is_array($value)) { $value = array_filter_recursive($value); } } return array_filter($input); } ?> //Or with callback parameter (not tested) : <?php function array_filter_recursive($input, $callback = null) { foreach ($input as &$value) … Read more