The method of using empty function in php is [bool empty (mixed $var)]. The empty() function is used to check whether a variable is empty. If the variable does not exist or the value is equal to false, it will be considered not to exist.
The operating environment of this article: windows10 system, php 7.3, thinkpad t480 computer.
The empty() function in php is used to check whether a variable is empty. empty() determines whether a variable is considered empty. When a variable does not exist, or its value is equal to FALSE, then it is considered not to exist. empty() does not generate a warning if the variable does not exist.
empty() After version 5.5, it supports expressions, not just variables.
Syntax structure:
bool empty ( mixed $var )
Example:
Running result:
$ivar1 is empty or 0.
$istr1 The string is not empty or 0.
Free learning video sharing:Introduction to programming
The above is the detailed content of How to use empty function in php. For more information, please follow other related articles on the PHP Chinese website!