Home > Backend Development > PHP Tutorial > 5 ways to determine whether an array is empty in PHP

5 ways to determine whether an array is empty in PHP

巴扎黑
Release: 2016-11-11 09:45:47
Original
961 people have browsed it

In PHP, "NULL" and "empty" are two concepts.
isset is mainly used to determine whether a variable has been initialized.
empty can judge variables with values ​​of "false", "empty", "0", "NULL" and "uninitialized" as TRUE.
is_null can only judge variables with values ​​of " NULL" variables are judged as TRUE
var == null Variables with values ​​​​"false", "empty", "0", and "NULL" are all judged as TRUE
var === null Only variables with values ​​​​are "NULL" The variable is judged to be TRUE
Note: When judging whether a variable is really "NULL", is_null is mostly used to avoid interference from "false", "0" and other values.

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