Home  >  Article  >  Backend Development  >  Summary of isset(), isnull() and empty() in php

Summary of isset(), isnull() and empty() in php

王林
王林forward
2020-01-04 17:36:582955browse

Summary of isset(), isnull() and empty() in php

isset()Detects whether the variable is set and non-NULL.

empty()Checks whether a variable is empty.

The following things are considered empty.

Summary of isset(), isnull() and empty() in php

isnull()Detect whether the variable is NULL.

(Recommended learning video: php video tutorial)

Examples are as follows:

isset

Determine whether the variable is defined first, whether the key value of the array exists, etc.

Summary of isset(), isnull() and empty() in php

empty

Summary of isset(), isnull() and empty() in php

In addition, PHP7 has a quick way to judge which is??and ?: Grammar, you should pay more attention to this.

Summary of isset(), isnull() and empty() in php

Through the above examples, you should understand the differences between these. As long as we pay more attention during development, we can choose the appropriate judgment function.

Conclusion:

Summary of isset(), isnull() and empty() in php

Recommended related articles and tutorials: php tutorial

The above is the detailed content of Summary of isset(), isnull() and empty() in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete