Double equals and tripple equals in php

后端 未结 7 509
囚心锁ツ
囚心锁ツ 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:28

    If you want such a strong validation, then the answer is: yes, definitely use ===.

    The == also does some very weird things, like comparing completely different string as equal, just because they are numerically equivalent. So === will probably be a better tool for you in most situations.

提交回复
热议问题