This function lets you know if a given variable is considered to be empty or not. The trick is remembering what values are considered to be empty. Zero, false, and others will be seen as “empty” and could trip you up.

$a = false;
$b = 0;
$c = '0';
$d = '';
$e = array();
$f = null;
$g = ' ';
$h = 'false';
$i = true;
$j = 1;
 
$res = empty($a); // true
$res = empty($b); // true
$res = empty($c); // true
$res = empty($d); // true
$res = empty($e); // true
$res = empty($f); // true
$res = empty($g); // false
$res = empty($h); // false
$res = empty($i); // false
$res = empty($j); // false

Only variables are allowed. Anything else will give you a parse error.

// The following will all produce parse errors
$res = empty('Q');
$res = empty(array());
$res = empty(false);