i am trying to unset a variable in a function. it looks basically like this:

$var = "hello world";

function remove()
{
global $var;
unset($var);
}

remove();
print $var;

okay, now what i want is for the variable to be unset on a global scope, not just the local scope. can i do this from a function?

much thanks in advance.

    function foo() {
    unset($GLOBALS['bar']);
    }

    $bar = "something";
    foo();

    Hope this helps;

      thanks for the help. works great now. i had the right idea just not quite right.

      thanks.

        Write a Reply...