Home  >  Article  >  Backend Development  >  php计算数组不为空元素个数的方法_php技巧

php计算数组不为空元素个数的方法_php技巧

WBOY
WBOYOriginal
2016-05-17 08:50:18851browse
复制代码 代码如下:

$arr = array(
1=>"11",
2=>"22",
3=>"33",
4=>""
);
print_r(count(array_filter($arr)));
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn