Page 1 of 1

Deleting all variables

Posted: Wed Jun 11, 2003 1:58 pm
by Bennettman
Is there a way in PHP to delete every variable on the page without typing out each variable unset($var1,$var2,etc) style?

Posted: Wed Jun 11, 2003 2:21 pm
by cactus
Not really, if you are using globals though, a bit drastic but you could:

Code: Select all

unset($GLOBALS);
But that would mean every single variable you create needs to be in the global scope.

I would suggest you ditch variables in favour of array's in this instance, at least then you only have to worry about a single variable (array), could be hard to program though.

Regards,