Andrew Rose wrote:
2008/11/17 Ting Chen <[EMAIL PROTECTED]>:
Hi everybody,
sorry this is a greenhand's stupid question. Why isn't "0.0" false? I
know it is a string but I still think it equals to 0.
I think you answered your own question there.
Andrew
What he means is that == is not transitive. That is,
"0" == false
"0" == "0.0"
But
false != "0.0"
The answer to "why" is, well, that's the way it is. "0.0" just "looks"
too much like a string, maybe, to be made into a boolean. You can just
cast it into int like (int) "0.0" to make it work, however.
Federico Lebron
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php