What is the differences between $a != $b and $a !== $b ?
What is the differences between $a != $b and $a !== $b ?
The differences between $a != $b and $a !== $b in PHP are:
Loose vs Strict Comparison:
$a != $b performs a loose comparison, which means it checks if the values of $a and $b are equal, but it may perform type juggling (automatic conversion of operands to a common type) if the operands are of different types.$a !== $b performs a strict comparison, which means it checks if the values of $a and $b are equal and if they are of the same type.Type Juggling:
$a != $b, if the operands are of different types, PHP may perform type juggling to convert them to a common type before comparing their values."5" != 5 will return false because the string "5" is converted to the integer 5 before the comparison."5" !== 5 will return true because the string "5" and the integer 5 are not of the same...junior