Quick Answer
empty() returns true if a variable is: not set, null, false, 0, 0.0, "0", "" (empty string), or [] (empty array). Different from isset() - empty also catches zero and empty strings. Use empty() when you want to check if a value is meaningless/absent. Caution: empty(0) is true, so use carefully with numeric values. isset($var) && $var !== "" is more explicit.
Answer
empty() checks if a variable contains an empty or falsy value (0, "", null, false).
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.
PHP interview questions and answers for beginner, junior, mid-level, senior, and expert developers. Ideal for freshers and experienced candidates preparing for PHP roles.