Re: bug or feature?
| From: | Pavel Jartsev | Date: | Wed, 14 Mar 2001 15:53:11 +0000 |
| Subject: | Re: bug or feature? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43859@lists.php.net to get a copy of this message | ||
indrek siitan wrote:
>
> Hi,
>
> <?
> $value=0;
> if ($value=="NULL")
> echo "Value is NULL!";
> else
> echo "Value is not null.";
> ?>
>
> output: Value is NULL!
>
> is it a bug or expected behaviour? tested it on 4.0.4pl1.
> i got around it by using strcasecmp(), but just wondering. :)
>
It's expected behaviour, i think.
'cause $value is integer, "NULL" is string and compare will convert
"NULL" into integer.
If condition is ($value==="NULL"), then output will be "Value is not
null.".
RTFM ;-)
--
Pavel a.k.a. Papi