What does null mean in php
Editor to share with you what null means in php, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
Null in php means "empty", a special flag is usually used to indicate that a variable has no value; when a variable is directly assigned to null, when the declared variable has not been assigned, or when the variable is destroyed by the unset () function, the value of a variable is considered to be null.
Operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer
What does null mean in php
One: what does null mean?
In php, NULL is a special tag, a null value indicates that a variable has no value, and the only possible value of the NULL type is NULL.
A variable is considered NULL in the following cases:
1. Is assigned to NULL.
two。 Has not been assigned yet.
3. By unset ().
Second: grammar
The NULL type has only one value, which is the case-insensitive constant NULL.
Is_null (mixed $var): bool
Returns TRUE if var is null, FALSE otherwise.
Check the NULL type to learn when a variable is considered NULL.
Three: switch to NULL
Converting a variable to null using (unset) $var will not delete the variable or its value unset. It just returns the NULL value.
Note: convert empty arrays to null through non-strictly equal'= 'comparisons. If it is possible to get an empty array, use is_null () or'='. $a = array ()
$a = = null