The usage of PHP empty (), isset (), and is_null () functions has been discussed a lot.
The test type is as follows:
Empty () is the var_dump output of empty first:
Program output: bool (true) can be seen from the code, empty () outputs true if the data type is null or false. Isset () let's look at the output of isset: var_dump (isset ($ a); var_dump (isset ($ B); var_dump (isset ($ c )); var_dump (isset ($ d); var_dump (isset ($ e); var_dump (isset ($ f); // output bool (false) bool (true) bool (true) bool (false) bool (true) it can be seen that isset () can only be used to determine whether it is NULL or undefined. Is_null () is the output of is_null: var_dump (is_null ($ a); var_dump (is_null ($ B); var_dump (is_null ($ c )); var_dump (is_null ($ d); var_dump (is_null ($ e); var_dump (is_null ($ f); // output bool (true) bool (false) bool (false) bool (true) bool (false) is_null literally. It can be seen that empty () can be used to determine whether all data types are NULL or false, while is_null is basically the same as isset and can only be used to determine whether it is NULL or undefined.