Given an array and we have to check if array is an empty or not using PHP.
To check whether an array is empty or not, we can use a built-in function empty(), in other cases where we want to check if a given variable is empty or not, it can also be used. It returns a Boolean response based on the condition that if the given variable contains a non-empty, non-zero value then it returns "false" otherwise, it returns "true".
Syntax:
empty ($var);
empty ($array);
PHP code:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer