php empty()

不言
Release: 2023-03-24 19:44:01
Original
3866 people have browsed it

This article mainly introduces the empty() function of PHP, which has a certain reference value. Now I share it with you. Friends in need can refer to it

empty() identifies "0" and 0 Or null($x)

That is, empty($x) == true is established


Note:

Prior to PHP 5.5, empty() only supported variables; anything else would cause a parsing error. In other words, the following code will not take effect: empty(trim($name)). As an alternative, trim($name) == false.


should be used when var exists and is a non-empty non-zero Returns FALSE if the value is a value, otherwise returns TRUE.
The following are considered empty:
"" (empty string)
0 (0 as an integer)
0.0 (0 as a floating point number) )
"0" (0 as a string)
NULL
FALSE
array() (an empty array)
$var; (a variable declared but without a value)

Related recommendations:

Some basic syntax of php

The above is the detailed content of php empty(). 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
Latest Issues
File is empty
From 1970-01-01 08:00:00
0
0
0
The host file is empty
From 1970-01-01 08:00:00
0
0
0
Why is my host file empty?
From 1970-01-01 08:00:00
0
0
0
empty is more strict than isset
From 1970-01-01 08:00:00
0
0
0
gosts content is empty
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template