1: What does the null value mean?
NULL is a special mark in php. The NULL value means that a variable has no value. NULL The only possible value of the type is NULL.
A variable is considered NULL under the following circumstances:
1. It is assigned a value of NULL.
2. It has not been assigned a value.
3. Be unset().
2: Syntax
The NULL type has only one value, which is the case-insensitive constant NULL.
<?php $var = NULL; ?>
is_null ( mixed $var ) : bool
Returns TRUE if var is null, otherwise returns FALSE.
Look at the NULL type to know when a variable is considered NULL.
Three: Converting to NULL
Using (unset) $var Converting a variable to null will not delete the variable or unset its value. Just returns a NULL value.
Note: Empty arrays are converted to null via non-strict equality '==' comparisons. If it is possible to get an empty array, use is_null() or '==='.
$a = array(); $a == null <== return true $a === null < == return false is_null($a) <== return false
NULL should represent no value and not be considered the value itself.
NULL is a null bit, this is missing information, talking about "null value" is a semantic awkwardness, but if a variable can exist without a value, then the language and implementation must have something to represent this situation.
The above is the detailed content of What does null value mean in PHP. For more information, please follow other related articles on the PHP Chinese website!