Re: Strange 'if' test bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$key=0;
$key=="muppet"?TRUE:FALSE;
The reason this last comparison returns true is that since you are comparing
an integer with a string, the strings gets converted to an integer and since
"muppet" does not have any numeric character it gets converted to 0. In
other words as far PHP in concerned you are comparing 0 with 0 which is why
the result of comparison is a true statement.

Any thoughts on this?

Thanks
Christian

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux