How to calculate if an array is not empty in php

怪我咯
Release: 2023-03-12 15:04:01
Original
1134 people have browsed it

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))); 
?
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!