Home  >  Article  >  Backend Development  >  How to calculate if an array is not empty in php

How to calculate if an array is not empty in php

怪我咯
怪我咯Original
2017-07-04 13:31:211130browse

This article will introduce to you how phpcalculates the number of elements in an array that are not empty. Friends who need it can refer to it

The code is as follows:

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

The above is the detailed content of How to calculate if an array is not empty in php. For more information, please follow other related articles on the PHP Chinese website!

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