Is integer zero null?
Posted: Wed Dec 31, 2008 3:45 am
Hi,
I wondered by checking the output of the following php script.
Instead of "Not Null" as I expected, I got the output as "Null".
The script works if I use any value except 0 or if I use quotes around 0.
The integer 0 is considered as null unlike other integers.
I am bit confused, can anyone help me out?
Thanks in advance …
I wondered by checking the output of the following php script.
Code: Select all
<?php
$test = 0;
if($test != '')
echo ' Not Null';
else
echo ' Null';
?>
The script works if I use any value except 0 or if I use quotes around 0.
The integer 0 is considered as null unlike other integers.
I am bit confused, can anyone help me out?
Thanks in advance …