In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Enrico Weigelt) wrote:
> is there a way for unsetting an global variable from an function ?
>
> global $var; unset ( $var );
>
> does not work since, unset only removes the reference in from
> local namespace. but i need to remove it from the global one.
>
> any chance to do it ?
Instead of using the 'global' keyword, use the $GLOBALS array:
$var='foobar';
function gUnset()
{
echo "BEFORE: {$GLOBALS['var']}";
unset($GLOBALS['var']);
echo "AFTER: {$GLOBALS['var']}";
}
gUnset();
--
CC
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php