Double equals and tripple equals in php

后端 未结 7 467
囚心锁ツ
囚心锁ツ 2021-01-18 01:54

I searched on StackOverflow and Google and I can\'t find the answer to this question:

Should we always use the triple equal in PHP for validation?

For exampl

7条回答
  •  失恋的感觉
    2021-01-18 02:47

    I would say it is better to always use === and remove one = in cases you can justify.

    And yes it's equal, though weird. Better way to write it is if(is_numeric($x) && $x == 1)

提交回复
热议问题