The Praetorian Posted May 25, 2007 Share Posted May 25, 2007 I'm adapting some php code according to a changelog, and the changelog tells me to change a specific line to this. if ( $navigation === false )Is there any reason to use three equals signs? Or is that most likely a typo? Link to comment Share on other sites More sharing options...
vijay Posted May 25, 2007 Share Posted May 25, 2007 Hi..I think you probably know.. $a === $b Identical TRUE if $a is equal to $b, and they are of the same type. so it's make u to comparision strictly type matching and then put comparisionRegards,Vijay Link to comment Share on other sites More sharing options...
justsomeguy Posted May 29, 2007 Share Posted May 29, 2007 To clarify that, the == operator checks for value equivalence, and the === operator checks for value and type equivalence. With that, the two values are only equivalent if they are also the same data type. So the string "1" and the number 1 are not type equivalent (one is a string, one is a number). $v1 = ("1" == 1 ? true : false); // true$v2 = ("1" === 1 ? true : false); // false$v3 = ("1" === "1" ? true : false); // true$v4 = (1 === 1 ? true : false); // true$v5 = (0 == false ? true : false); // true$v6 = (0 === false ? true : false); // false Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.