zoukankan      html  css  js  c++  java
  • php中0,'',null,false,true,FLASE,TREU,array()的相等恒等学习

    简介:这是php中0,'',null,false,true,FLASE,TREU,array()的相等恒等学习的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

    class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=341541' scrolling='no'>

    "Null" means "nothing". The var has not been initialized.

    "False" means "not true in a boolean context". Used to explicitely show you are dealing with logical issues.

    0 is an int. Nothing to do with the rest above, used for mathematics.

    Now, what is tricky, it's that in dynamic languages like PHP, all of them have a value in a boolean context, which is "False".

    If you test it with "==", it's testing the boolean value, so you will get equality. If you test it with "===", it will test the type, and you will get inequality.

    //比较值 '' NULL 0 false true FALSE TRUE arrau()
    //相等判断
    //'' == NULL == 0 == false (相等)
    //array() = 0 == NULL == false (相等)
    //array() <> '' (不相等)
    //恒等判断
    //任何两个数比较都不恒等
    //var_dump(false == FALSE); //bool(true)
    //var_dump(false === FALSE); //bool(true)
    //var_dump(true == TRUE); //bool(true)
    //var_dump(true === TRUE); //bool(true)
    //var_dump('' == NULL); //bool(true) 
    //var_dump('' === NULL); //bool(false)
    //var_dump('' == 0); //bool(true) 
    //var_dump('' === 0); //bool(false)
    //var_dump('' == false); //bool(true) 
    //var_dump('' === false); //bool(false)
    //var_dump('' == true); //bool(false) 
    //var_dump('' === true); //bool(false)
    //var_dump(null == 0); //bool(true) 
    //var_dump(null === 0); //bool(false)
    //var_dump(null == false); //bool(true) 
    //var_dump(null === false); //bool(false)
    //var_dump(null == true); //bool(false) 
    //var_dump(null === true); //bool(false)
    //var_dump(0 == false); //bool(true) 
    //var_dump(0 === false); //bool(false)
    //var_dump(0 == true); //bool(false) 
    //var_dump(0 === true); //bool(false)
    //对true的一些判断
    //var_dump('1' == true); //bool(true)
    //var_dump('1' === true); //bool(false)
    //var_dump(1 == true); //bool(true)
    //var_dump(1 === true); //bool(false)
    //var_dump(array() == true); //bool(false)
    //var_dump(array() === true); //bool(false)
    //array()比较
    //var_dump(array() == ''); //bool(false) 
    //var_dump(array() === ''); //bool(false)
    //var_dump(array() == NULL); //bool(true) 
    //var_dump(array() === NULL); //bool(false)
    //var_dump(array() == 0); //bool(false) 
    //var_dump(array() === 0); //bool(false)
    //var_dump(array() == false); //bool(true) 
    //var_dump(array() === false); //bool(false)
    //var_dump(array() == true); //bool(false) 
    //var_dump(array() === true); //bool(false)
    //恒等比较
    //var_dump(0 === '0'); //bool(false)
    //var_dump(0 === 00); //bool(true) 
    //var_dump(00 === intval('0')); //bool(true)

    爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

    http://biancheng.dnbcw.info/php/341541.html pageNo:6
  • 相关阅读:
    MFC之界面提示(CToolTipCtrl类)
    Windows的三种坐标系:屏幕坐标系,非客户区坐标系,客户区坐标系
    【数据库】insert语句
    【js】v-for 的一些用法 :class {{index}}
    jQuery查找选中的checkbox个数
    limit offset
    http状态码
    Whitelabel Error Page
    【Mybatis】Mybatis generator的使用
    【CSS】Bootstrap 图标
  • 原文地址:https://www.cnblogs.com/ooooo/p/2243920.html
Copyright © 2011-2022 走看看