Re: a stupid question

From: Date: Mon, 17 Nov 2008 14:18:08 +0000
Subject: Re: a stupid question
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-41975@lists.php.net to get a copy of this message
Andrew Rose wrote:
2008/11/17 Ting Chen <gilltdr1008@gmail.com>:
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

« previous php.internals (#41975) next »