Welcome Guest, Not a member yet? Register   Sign In
Why is this true?
#3

[eluser]WanWizard[/eluser]
My guess:

You are comparing an integer with a string. PHP wants to do an integer compare. It therefore converts "text" to an integer, which is 0, and 0 == 0 evaluates to true.

Compare that with:
Code:
$key = 0;
if ((string) $key == "text") {
    echo "true";
} else {
    echo "false";
}


Messages In This Thread
Why is this true? - by El Forum - 07-27-2010, 02:13 AM
Why is this true? - by El Forum - 07-27-2010, 02:21 AM
Why is this true? - by El Forum - 07-27-2010, 02:25 AM
Why is this true? - by El Forum - 07-27-2010, 05:38 AM
Why is this true? - by El Forum - 07-27-2010, 11:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB