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

后端 未结 4 636
梦如初夏
梦如初夏 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:18

    $a != $b

    TRUE if $a is not equal to $b after type juggling.

    $a !== $b

    TRUE if $a is not equal to $b, or they are not of the same type.


    See type juggling in PHP for more info on type juggling.


    Sources : php.net

提交回复
热议问题