How do I count non-empty array items in PHP but excluding 0. Zero is a falsy value that's why it's not included in the counting when I use array_filter. In the example below what I want to get when I echo the count is 4 since there are 4 items in the array
$numbers = array(0,2,4,2);
echo count(array_filter($numbers));
And if it is like this the output should be 5, empty string excluded from the counting but the 2 zeroes are still included:
$numbers = array(0,2,4,2,'',0);
echo count(array_filter($numbers));