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!