PHP NULL type:
In PHP 4 a special type of value is introduced, which indicates that a variable does not consists of any value or NULL value. NULL is the only value of NULL datatype.
A variable is considered to be NULL if we use unset() method on a variable, or a NULL value is assigned to the variable, no value is yet assigned to it.
Two special functions are used in this context, is_null() and unset(). is_null() function is used to check whether a variable is NULL assigned or it has some value.
PHP Null Type Example:
<?php
$a
;echo
"1=True and Blank=False".is_null($a)."<br/>";$a
=23;echo
"1=True and Blank=False".is_null($a)."<br/>";$a
=NULL;echo
"1=True and Blank=False".is_null($a)."<br/>";$a
=12;echo
"1=True and Blank=False".is_null($a)."<br/>";unset
($a);echo
"1=True and Blank=False".is_null($a)."<br/>";?>
Output:
1=True and Blank=False1
1=True and Blank=False
1=True and Blank=False1
1=True and Blank=False
1=True and Blank=False1
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.