0
可能重複:
how to count non-empty entries in php array?計數數組中非空項目的數量?
我希望計算數組不爲空/空鍵的數量。
EG:
array(1>'asdf',2>'fdas',3>'');
count($array) would return 3, I want a function that returns 2 as 3 is empty
是否有任何PHP內置函數來做到這一點?如何做呢?
http://stackoverflow.com/questions/9789083/exclude-null-values-from-count-in-array http://stackoverflow.com/questions/4422889/how-to-count-non -phpty-entries-in-php-array – RezaSh
學習[PHP的數組函數](http://php.net/manual/en/ref.array.php)和[成爲更好的PHP開發人員](http:// jason .pureconcepts.net/2012/08 /更好的PHP開發者/) –