RE: [PHP] 0 == null ?
| From: | Justin Palmer | Date: | Mon, 10 May 2004 19:31:38 +0000 |
| Subject: | RE: [PHP] 0 == null ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185842@lists.php.net to get a copy of this message | ||
Hi Robert,
Thanks.
Regards,
Justin Palmer
-----Original Message-----
From: Robert Cummings [mailto:robert@interjinn.com]
Sent: Monday, May 10, 2004 12:22 PM
To: justin@cetusa.org
Cc: PHP-General
Subject: Re: [PHP] 0 == null ?
On Mon, 2004-05-10 at 15:17, Justin Palmer wrote:
> Hi,
>
> Does 0(zero) really equate to null?
>
> if( 0 == null )
> {
> echo 'true';
> }
> else echo 'false';
>
> Result echo's: true
>
> This can not be right, can it? I have never heard of such a thing.
> As far as I recall from any language null is of no value equaling
> nothing? So how can it equal 0?
>
> Any help or explanation would be greatly appreciated.
In C the NULL macro is equal to 0. In PHP null is equivalent to 0. The
test will fail if you use === instead.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting | a
| powerful, scalable system for accessing system services | such as
| forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php