Table of Contents
The empty() function is an built-in function in PHP which is used to check whether a variable is empty or not. A variable is empty if it does not exist or if its value equals false.
Note:
The empty() function does not create a warning if the variable does not exist which means empty() is equivalent to !isset($var) || $var == false.
List of empty Value :
- 0 – 0 as an integer
- “0” – 0 as a string
- “” – An empty string
- 0.0 – 0 as a float
- NULL
- FALSE
- array() – An empty array
- $var_name; – A variable declared but without a value in a class