update page now
PHP 8.1.34 Released!

Voting

: eight plus one?
(Example: nine)

The Note You're Voting On

jmarbas at hotmail dot com
20 years ago
empty($var) will return TRUE if $var is empty (according to the definition of 'empty' above) AND if $var is not set.

I know that the statement in the "Return Values" section of the manual already says this in reverse:

"Returns FALSE if var has a non-empty and non-zero value." 

but I was like "Why is this thing returning TRUE for unset variables???"... oh i see now... Its supposed to return TRUE for unset variables!!!

<?php
  ini_set('error_reporting',E_ALL);
  ini_set('display_errors','1');
  empty($var);
?>

<< Back to user notes page

To Top