Deleting all variables
Moderator: General Moderators
-
Bennettman
- Forum Contributor
- Posts: 130
- Joined: Sat Jun 15, 2002 3:58 pm
Deleting all variables
Is there a way in PHP to delete every variable on the page without typing out each variable unset($var1,$var2,etc) style?
Not really, if you are using globals though, a bit drastic but you could:
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,
Code: Select all
unset($GLOBALS);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,