php method of calculating the number of non empty elements in an array
- 2020-12-20 03:32:00
- OfStack
<?php
$arr = array(
1=>"11",
2=>"22",
3=>"33",
4=>""
);
print_r(count(array_filter($arr)));
?>
<?php
$arr = array(
1=>"11",
2=>"22",
3=>"33",
4=>""
);
print_r(count(array_filter($arr)));
?>