Home >Backend Development >PHP Tutorial >Two examples of php judging that the array is empty_PHP tutorial
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);
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 Previous article:Convert datetime type date and time to Chinese representation_PHP tutorialNext article:Convert datetime type date and time to Chinese representation_PHP tutorial Related articlesSee more |