如何让PHP阵不仅没有null元素计数 [英] how to get only not null element count in array php
本文介绍了如何让PHP阵不仅没有null元素计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想只得到NOT NULL值计算该数组中,如果我使用计数()
或的sizeof
它会得到空指标也。
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 .
在我的情况
我有这样的阵列阵列([0] =>)
在计数
是 1
。但我想要得到的不是null计数,inthis情况下,它应该是 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............................
推荐答案
只需使用array_filter()没有回调
simply use array_filter() without callback
print_r(array_filter($entry));
这篇关于如何让PHP阵不仅没有null元素计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文