what's the difference between 2 equals and 3??
if (x==y) and if (x===y)
Page 1 of 1
comparing diference
#4
Posted 08 March 2012 - 05:09 PM
NOTE: moved to proper section (General PHP Topics instead of General Discussion for Yii 1.1.x)
Find more about me.... btw. Do you know your WAN IP?
#5
Posted 14 May 2012 - 02:38 AM
zipzap, on 08 March 2012 - 04:33 PM, said:
what's the difference between 2 equals and 3??
if (x==y) and if (x===y)
if (x==y) and if (x===y)
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.
Share this topic:
Page 1 of 1

Help














