Re: Re: [RFC] Comparison and conversion inconsistency - need more info
| From: | Yasuo Ohgaki | Date: | Sun, 10 Nov 2013 20:57:41 +0000 |
| Subject: | Re: Re: [RFC] Comparison and conversion inconsistency - need more info | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70091@lists.php.net to get a copy of this message | ||
Hi Sanford,
On Mon, Nov 11, 2013 at 5:28 AM, Sanford Whiteman <
swhitemanlistens-software@cypressintegrated.com> wrote:
> > [yohgaki@dev ~]$ php -r "var_dump((NULL < -100));"
> > bool(true)
>
> Equiv to FALSE < TRUE
>
> > [yohgaki@dev ~]$ php -r "var_dump((NULL > -100));"
> > bool(false)
>
> Equiv to FALSE > TRUE
>
> > NULL behaves differently, though.
>
> Differently from what? It's exactly as specified in the docs.
My previous post is wrong.
TRUE only evaluated as 1 otherwise FALSE.
FALSE/NULL evaluated as 0 or least.
That's what we need in document. IMO.
However, this behavior seems weird.
[yohgaki@dev ~]$ php -r "var_dump((FALSE < -100));"
bool(true)
[yohgaki@dev ~]$ php -r "var_dump((FALSE > -100));"
bool(false)
[yohgaki@dev ~]$ php -r "var_dump((TRUE < -100));"
bool(false)
[yohgaki@dev ~]$ php -r "var_dump((TRUE > -100));"
bool(false)
It's really confusing to me :(
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net