dear all the friends this is very nice question and this type of questions is asking in interview so every php developer should be knowledge of what the use of == and === and whats the difference between them
so let me explain in brief
== should be used to check if the values of the two operands are equal or not. while === checks the values as well as the type of operands.
Let me explain more with example,
if("123" == 123)
- using above code we get result as a yes.
-using above code we also get the same result because “123″ is string and in right side we have used (string)123 so that both is consider same so condition is true and it prints yes and suppose if we not used (string)123 in right side of condition and using like if(“123″===123) than it prints “no”.
so this is the difference between == and ===
in short, whenever you want to compare the two values as well as the types of operands you will use “===” otherwise you use “==”.