Home >Backend Development >PHP Tutorial >PHP method to count the number of non-empty elements in an array_PHP Tutorial

PHP method to count the number of non-empty elements in an array_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:39:471093browse

Copy code The code is as follows:

$arr = array(
1=>"11 ",
2=>"22",
3=>"33",
4=>""
);
print_r(count(array_filter($arr) ));
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/728106.htmlTechArticleCopy the code as follows: ?php $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