Test for NULL value in a variable that may not be set
<p>Considering that:</p>

<ul>
<li>The <a href="http://es.php.net/isset" rel="nofollow">isset()</a> construct returns TRUE if a variable is set and not NULL</li>
<li>The <a href="http://es.php.net/is_null" rel="nofollow">is_null()</a> function throws a warning if the variable is not set</li>
</ul>

<p>Is there a way to test whether a variable exists, no matter it's NULL or not, without using the @ operator to suppress the notice?</p>

<hr>

<p><strong>EDIT</strong></p>

<p>Together with your first replies, I've been thinking about this and I'm getting the conclusion that inspecting get_defined_vars() is the only way to distinguish between a variable set to NULL and an unset variable. PHP seems to make little distinctions:</p>

<pre><code>&lt;?php

$exists_and_is_null = NULL;

// All these are TRUE

@var_dump(is_null($exists_and_is_null));
@var_dump(is_null($does_not_exist));

@var_dump($exists_and_is_null===NULL);
@var_dump($does_not_exist===NULL);

@var_dump(gettype($exists_and_is_null)=='NULL');
@var_dump(gettype($does_not_exist)=='NULL');

?&gt;
</code></pre>
