Re: 0 == null ?

From: Date: Mon, 10 May 2004 19:22:28 +0000
Subject: Re: 0 == null ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185838@lists.php.net to get a copy of this message
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. | `------------------------------------------------------------'

« previous php.general (#185838) next »