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

[eluser]xwero[/eluser]
I think it has to do with the weak typing in php. That why the === operator is useful. If you do
Code:
$test1 = 0;
$test2 = 'string';
if ($test1 === $test2) {
    echo 'yes';
}
You get no output because it also checks the type.

I read something similar not so long ago with the explanation of similar behavior but i can't find it at the moment.


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