I have an array like this:
$items = ['a', 'b', null, null];
I want count [nulls] in this array which is 2.
But: Without replacing them before working with. Like this:
$items = array_replace($items,array_fill_keys(array_keys($items, null),''));
array_count_values($items);
And: Without removing them from the array and put them out of the total. Like this:
count($items) - count(array_filter($items));
I'm trying to know more better solutions.
count()twice?[null, 1, null, null]is that two or three?