php tutorial - PHP Empty Function - php programming - learn php - php code - php script
What is PHP empty functions - Purpose of empty function
Syntax to use empty function
An example of using the empty function
An example with integer type variable
An empty example with array element
Why we use the empty function?
How to use PHP empty function
- This is what the empty function takes as ‘empty’:
- If your string contains no characters or it is like this: Str = “”;
- Then this will be considered as empty.
- If a variable is not defined or does not exist, it will be considered as empty.
- If you have declared a variable and not given any value, this will still be considered as empty.
- If a Boolean variable is False, this is also considered as empty.
- The integer or float variable with 0 value are also considered as empty.
- A variable with NULL value is also taken as empty.
- An empty array is also taken as “empty”.