var_dump(empty($a));
var_dump(empty($b));
var_dump(empty($c));
var_dump(empty($d));
var_dump(empty($e));
var_dump(empty($f));
?>
The program output is:
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
As can be seen from the code, empty() outputs true as long as the data type is empty or false.
isset()
Look at the output of isset:
var_dump(isset($a));
var_dump(isset($b));
var_dump(isset($c));
var_dump(isset($d));
var_dump(isset($e));
var_dump(isset($f));
// Output
bool(false)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
It can be seen that isset() can only be used to determine whether it is NULL and undefined.
is_null()
Finally is the output of is_null:
var_dump(is_null($a));
var_dump(is_null($b));
var_dump(is_null($c));
var_dump(is_null($d));
var_dump(is_null($e));
var_dump(is_null($f));
// Output
bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
is_null is literal.
It can be seen that empty() can be used to determine whether all data types are empty or false, while is_null is basically the same as isset and can only be used to determine whether it is NULL and undefined.
http://www.bkjia.com/PHPjc/477874.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477874.htmlTechArticleThe usage of these three functions of PHP empty(), isset() and is_null() has been discussed There are a lot, and a lot of the information may not be very clear. Repeat here again, but not from...
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