$variablename_to_check_against = "varname";
$vars = get_defined_vars();
if (array_key_exists($variablename_to_check_against, $vars) && is_null($$variablename_to_check_against)) {
echo "$variablename_to_check_against is NULL and exists";
}
get_defined_vars
returns the local variable scope (inclusive the superglobals) in key-value pairs.
As array_key_exists
returns also true when the variable is NULL
, you can use it; then you only have to check if the variable is NULL
with is_null
.