Re: Comparison: ('*' == 0) ... True or false
| From: | Alexey Zakhlestin | Date: | Tue, 11 Mar 2008 10:22:28 +0000 |
| Subject: | Re: Comparison: ('*' == 0) ... True or false | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-36094@lists.php.net to get a copy of this message | ||
On 3/11/08, Scott McNaught [Synergy 8] <scott.mcnaught@synergy8.com> wrote:
> I don't know whether to post this as a bug or not. But I was tricked when programming
> today.
>
> It seems that the character "*" is non-strictly equivalent to 0. Is this the
> correct behavior or am I missing something?
>
> Test case:
>
> <?php
>
> var_dump('*' == 0);
>
> ?>
>
> Shows boolean(true).
>
> I was unable to find any documentation as to why this would be the case.
try
<?php
echo intval("*");
?>
that should explain the situation ;)
--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/