Home > Backend Development > PHP Tutorial > Parsing the test of empty is_null and isset in PHP_PHP Tutorial

Parsing the test of empty is_null and isset in PHP_PHP Tutorial

WBOY
Release: 2016-07-21 15:02:29
Original
1024 people have browsed it

The code is as follows:

Copy codeThe code is as follows:

$a;
$b = false;
$c = '';
$d = 0;
$e = null;
$f = array();

First is the var_dump output of empty:
boolean true
boolean true
boolean true
boolean true
boolean true
boolean true

Then the output of is_null:
boolean true
boolean false
boolean false
boolean false
boolean true
boolean false

Finally is the output of isset:
boolean false
boolean true
boolean true
boolean true
boolean false
boolean true
Therefore 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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327918.htmlTechArticleThe code is as follows: Copy the code as follows: ?php $a; $b = false; $c = ''; $d = 0; $e = null; $f = array(); First is the empty var_dump output: boolean true boolean true boolean true bool...
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