I'm really confused as to why this operation works. Can someone explain it?
$test1 = "d85d1d81b25614a3504a3d5601a9cb2e";
$test2 = "3581169b064f71be1630b321d3ca318f";
if ($test1 == 0)
echo "Test 1 is Equal!?";
if ($test2 == 0)
echo "Test 2 is Equal!?";
// Returns: Test 1 is Equal!?
For clarification, I am trying to compare the string "0"
to the $test
variables. I already know to fix the code I can just enclose (as I should have) the 0
in ""
s
I'm wondering if this is a PHP bug, a server bug, or somehow a valid operation. According to http://us3.php.net/types.comparisons this should not have worked.
Edit: Scratch that, apparently it does mention that Loose comparisons between string and 0 is true. But I still don't know why.
Edit 2: I've revised my question, why does the $test2
value of "3581169b064f71be1630b321d3ca318f"
not work?