PHP's variable type leniency

后端 未结 3 1175
耶瑟儿~
耶瑟儿~ 2020-12-18 07:26

The most recent comment on PHP\'s in_array() help page (http://uk.php.net/manual/en/function.in-array.php#106319) states that some unusual results occur as a re

3条回答
  •  忘掉有多难
    2020-12-18 08:11

    763 == true because true equals anything not 0, NULL or '', same thing for array because it is a value (not an object).

    To circumvent this problem you should pass the third argument as TRUE to be STRICT and thus, is_rray will do a === which is a type equality so then

    763 !== true

    and neither will array() !== true

提交回复
热议问题