You are here: Re: Zero and NULL « PHP SQL « IT news, forums, messages
Re: Zero and NULL

Posted by David Gillen on 01/09/07 16:00

Paul Lautman said:
> Heiko Richler wrote:
>> if sub_page is 0 it sets page=5 ?
>>
> Yep it sure does.
>
> Thanks for the hint on the way that switch comares work.
>
> Wierd thing is that, whilst it seems to treat NULL as 0, if I put a NULL
> test in befor ethe 0 one, it does not detect 0 as NULL.
>
> So it seems NULL = 0 but 0 != NULL.
>
>
Not if I run this block of code.
<?
if(0 != NULL)
{
echo "0 is NOT equal to NULL<br>\n";
}
else
{
echo "0 is equal to NULL<br>\n";
}

if(NULL == 0)
{
echo "NULL is equal to 0<br>\n";
}
else
{
echo "NULL is not equal to 0<br>\n";
}
?>

Result is
0 is equal to NULL
NULL is equal to 0

D.
--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация