Does PHP negation check with `!` coprrespond to `!=` or to `!==`?

后端 未结 4 639
梦如初夏
梦如初夏 2021-01-27 18:34

In PHP, is

if(!$foo)

equivalent with

if($foo != true)

or with

if($foo !== true)
4条回答
  •  无人共我
    2021-01-27 19:03

    if(!$foo)
    

    is the equivalent to

    if($foo != true)
    

    so

    $foo = null;
    if(!$foo){
     echo "asd";
    }
    

    will ouptut "asd"

提交回复
热议问题