What does “===” mean?

前端 未结 10 1470
一生所求
一生所求 2020-11-27 06:01

I\'ve noticed someone using the PHP operator === which I can\'t make sense out of. I\'ve tried it with a function, and it corresponds in crazy ways.

Wha

10条回答
  •  萌比男神i
    2020-11-27 06:49

    See Double and Triple equals operator in PHP that I got for googling on "PHP three equals operator".

    At one point it says that:

    A double = sign is a comparison and tests whether the variable / expression / constant to the left has the same value as the variable / expression / constant to the right.

    A triple = sign is a comparison to see whether two variables / expresions / constants are equal AND have the same type - i.e. both are strings or both are integers.

    It also gives an example to explain it.

提交回复
热议问题