NULL datatype in PHP
How to define an NULL variable and assign value?
The special NULL value represents that a variable has no value. NULL is the only possible value of type NULL.
A variable is considered to be NULL if
- it has been assigned the constant NULL.
- it has not been set to any value yet.
- it has been unset()
There is only one value of type NULL, and that is the case-insensitive keyword NULL. NULL variable can be declared as
$var = NULL;
Here the variable hold the Null value so it is of type NULL. If you want to get a type of a variable, you can use gettype() function.
Is_Null() function is used to find whether the variable is Null variable or not. This function returns true if it is Null variable otherewise return false.