I think the simplest way would be (!$var and $var!=0)
, but is there a way to do it without repeating the var name?
function foo($var)
{
return ($var === false || $var === null || is_array($var));
}
if(foo($your_var)){}
After reading your comment, I think this is what you want:
function really_empty($var) {
return $var !== 0 && empty($var);
}
$var !== 0
satisfies your requests, it returns false on zero and true on everything else (including false, null and empty arrays).