Quote:
Originally Posted by edgeprod
Just be careful with this .. a lot of people here have a "sort of" understanding of PHP. If you use the exact match syntax with other variable types, PHP acts in unexpected ways. For example, even though PHP has a very forgiving manner of variable typing (string versus float, etc) when compared to C or Java, it acts strictly when using ===.
$variable = '5';
if ($variable === 5) will react differently than if ($variable == 5) or if ($variable === '5')
(false, true, true)
|
Correct, quoted 5 is not type integer; the variable type must match for exact match.
And that pretty much sums up what the thread is about.
Doing the correct test on the returned value, which this time requires type.