Blogger Information
Blog 12
fans 1
comment 1
visits 12056
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
详细说明 empty(),isset(),is_null()的区别-2018-04-12
Lucifer的博客
Original
846 people have browsed it

<?php


//首先写出5个不同情况变量

$a;

$b = false;

$c = '';

$d = 0;

$e = null;

$f = array();

//1:empty的var_dump输出,只要数据类型是否为空或假,empty()就输出true。

echo "<pre>";

var_dump(empty($a));

var_dump(empty($b));

var_dump(empty($c));

var_dump(empty($d));

var_dump(empty($e));

var_dump(empty($f));

echo "<hr>";

//2:isset的输出,isset只能用来判断是否为NULL和未定义

var_dump(isset($a));

var_dump(isset($b));

var_dump(isset($c));

var_dump(isset($d));

var_dump(isset($e));

var_dump(isset($f));

echo "<hr>";

//3.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));



?>


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post