# a stupid question

- Thread: https://externals.io/message/41973
- Original archive: https://news-web.php.net/php.internals/41973
- Started by Ting Chen on 2008-11-17T12:45:06+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #41973 — Ting Chen — 2008-11-17T12:45:06+00:00

URL: https://externals.io/message/41973#41973

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.

Thanks ahead,  green green~~

---

## #41974 — Andrew Rose — 2008-11-17T13:01:48+00:00

URL: https://externals.io/message/41973#41974 · In reply to: #41973

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

---

## #41976 — Ting Chen — 2008-11-17T13:22:29+00:00

URL: https://externals.io/message/41973#41976 · In reply to: #41974

i am recently studying Php5 manul. This is one of the examinations in
the book. The answer is "0.0" is true rather than false. I am very
curious about why if the answer is not wrong.

green geen still green~



> 2008/11/17 Ting Chen <gilltdr1008@gmail.com>:
>
> > […]
>
>
> I think you answered your own question there.
>
>
>  Andrew

---

## #41977 — Igor Feghali — 2008-11-17T13:46:29+00:00

URL: https://externals.io/message/41973#41977 · In reply to: #41976

maybe because "0" evaluating to false is already enough and everything
after that would be "forcing" too much. If "0.0" evaluates to false
then I would ask, why "0.0E1" doesn't ? What about "0.0E2" ? "0.0E10"
? etc. Just my opinion.

regards,
Igor.


> i am recently studying Php5 manul. This is one of the examinations in
> the book. The answer is "0.0" is true rather than false. I am very
> curious about why if the answer is not wrong.

---

## #41975 — Federico Lebron — 2008-11-17T14:18:08+00:00

URL: https://externals.io/message/41973#41975 · In reply to: #41974

Andrew Rose wrote:
> 2008/11/17 Ting Chen <gilltdr1008@gmail.com>:
> > […]
> 
> 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

---

## #41996 — Ting Chen — 2008-11-19T11:32:47+00:00

URL: https://externals.io/message/41973#41996 · In reply to: #41977

thanks for answering my question,

green, green, I am so green


> maybe because "0" evaluating to false is already enough and everything
>  after that would be "forcing" too much. If "0.0" evaluates to false
>  then I would ask, why "0.0E1" doesn't ? What about "0.0E2" ? "0.0E10"
>  ? etc. Just my opinion.
>
>  regards,
>
> Igor.
>
>
>  
> > […]
