View Single Post
Old 06-01-2014, 03:10 PM  
edgeprod
Permanently Gone
 
Industry Role:
Join Date: Mar 2004
Posts: 10,019
Quote:
Originally Posted by blackmonsters View Post
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.
Remember that it can also be cast:

$var = '5';

$result = ((int) $var === 5) ? true : false;

This will also result in a true evaluation, although it's not readily apparent to junior-level guys.
edgeprod is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote