码迷,mamicode.com
首页 > Web开发 > 详细

PHP中 比较 0、false、null

时间:2021-06-28 18:20:33      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:实例   false   比较   dump   php_eol   als   var   lse   echo   

<?php
echo ‘0 == false: ‘;
var_dump(0 == false);
echo ‘0 === false: ‘;
var_dump(0 === false);
echo PHP_EOL;
echo ‘0 == null: ‘;
var_dump(0 == null);
echo ‘0 === null: ‘;
var_dump(0 === null);
echo PHP_EOL;
echo ‘false == null: ‘;
var_dump(false == null);
echo ‘false === null: ‘;
var_dump(false === null);
echo PHP_EOL;
echo ‘"0" == false: ‘;
var_dump("0" == false);
echo ‘"0" === false: ‘;
var_dump("0" === false);
echo PHP_EOL;
echo ‘"0" == null: ‘;
var_dump("0" == null);
echo ‘"0" === null: ‘;
var_dump("0" === null);
echo PHP_EOL;
echo ‘"" == false: ‘;
var_dump("" == false);
echo ‘"" === false: ‘;
var_dump("" === false);
echo PHP_EOL;
echo ‘"" == null: ‘;
var_dump("" == null);
echo ‘"" === null: ‘;
var_dump("" === null);

以上实例输出结果为:

0 == false: bool(true)
0 === false: bool(false)

0 == null: bool(true)
0 === null: bool(false)

false == null: bool(true)
false === null: bool(false)

"0" == false: bool(true)
"0" === false: bool(false)

"0" == null: bool(false)
"0" === null: bool(false)

"" == false: bool(true)
"" === false: bool(false)

"" == null: bool(true)
"" === null: bool(false)

文章来自 www.dg-haiyue.cn

PHP中 比较 0、false、null

标签:实例   false   比较   dump   php_eol   als   var   lse   echo   

原文地址:https://www.cnblogs.com/96net/p/14933372.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!