Welcome Guest, Not a member yet? Register   Sign In
Simple if statement returning unexpected results
#7

[eluser]John_Betong[/eluser]
 
I looked again in the PHP Manual for Comparison Operators and found this explanation and example:
Quote: $a === $b Identical TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)

Also

If you compare an integer with a string, the string is converted to a number.
If you compare two numerical strings, they are compared as integers.

<?php

var_dump(0 == "a"); // 0 == 0 -> true
var_dump("1" == "01"); // 1 == 1 -> true
var_dump("1" == "1e0"); // 1 == 1 -> true

?>
 
 


Messages In This Thread
Simple if statement returning unexpected results - by El Forum - 05-08-2008, 05:43 PM
Simple if statement returning unexpected results - by El Forum - 05-08-2008, 08:40 PM
Simple if statement returning unexpected results - by El Forum - 05-08-2008, 09:19 PM
Simple if statement returning unexpected results - by El Forum - 05-08-2008, 10:49 PM
Simple if statement returning unexpected results - by El Forum - 05-08-2008, 11:29 PM
Simple if statement returning unexpected results - by El Forum - 05-08-2008, 11:51 PM
Simple if statement returning unexpected results - by El Forum - 05-09-2008, 09:13 PM
Simple if statement returning unexpected results - by El Forum - 05-09-2008, 09:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB