The following provides two PHP codes that determine whether the array is empty. Because the array is a composite data type, we cannot process it like other character data. See examples below.
Method
1. Use count (array) to get records. Empty returns 0
2. Use is_null function
The code is as follows
|
Copy code
|
||||
$a=array('1','2','3');
echo count($a);
Previous article:Convert datetime type date and time to Chinese representation_PHP tutorial
Next article:Image verification code generation application example_PHP tutorial
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
Latest Articles by Author
Latest Issues
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|