Skip to content
Advertisement

how to get only not null element count in array php

i want to get only not null values count in that array , if i use count() or sizeof it will get the null indexes also .

in my case

i have an array like this Array ( [0] => )

the count is 1 . but i want to get the not null count , inthis case it should be 0 , how can i do this , please help……………………….

Advertisement

Answer

simply use array_filter() without callback

print_r(array_filter($entry));
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement