what’s the difference between 2 equals and 3??
if (x==y) and if (x===y)
what’s the difference between 2 equals and 3??
if (x==y) and if (x===y)
thanks
NOTE: moved to proper section (General PHP Topics instead of General Discussion for Yii 1.1.x)
The operator "==" checks only the values if they are equal instead of having different types Like
if(True == 1) will return true by the operator "==" because True is Boolean and 1 is binary while True reefers to 1 in binary.
While "===" operator checks for the type also. Like
if(True === 1) will return false because both types are not same.
So use of operator == and === depends on the requirement basis.