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
http://www.php.net/ternary
$a == $b Equal TRUE if $a is equal to $b, except for (True == -1) which is still True.
$a === $b Identical TRUE if $a is equal to $b, and they are of the same type.
> "5" == 5;
True
> "5" === 5;
False
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.
For PHP, there many different meanings a zero can take
So === is added to ensure the type and the value are the same.
"===" matching the value in the variable as well as data type of the variable.