php function for checking the existence of variable, if the variable doesn't exist then write a default value for the variable
<p>i'm in need of a php function whose first argument will check that the variable exist or not outside of the function, if variable exist then echo it's value and if the variable doesn't exist then echo a default value for the variable given in second argument of the function. and in last remove(delete) both the variable passed to the function just after echoing their values.</p>

<p>simply :</p>

<pre>
function if_exists ($argument, $default)
{
// if $argument exist then echo it's value and then remove $argument variable.
// if the $argument doesn't exist then echo it's $default value and then remove $default variable.
}
</pre>

<p>i will use it like this :</p>

<pre>
$any_variable
if_exists ($any_variable, 'this variable is not defined');
</pre>

<p>this code is not doing the perfect job for me :</p>

<pre>
function if_exist(&$argument, $default = '')
{
    if (isset ($argument))
    {
        echo $argument;
    }
    else
    {
        echo $default;
        unset ($default);
    }
}
</pre>

<p>thanks.</p>
