note 39397 added to function.unset

From: Date: Tue, 27 Jan 2004 13:52:36 +0000
Subject: note 39397 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-64249@lists.php.net to get a copy of this message
you may wan't to unset all variables which are defined, here's one way: <?php function unset_all_vars($a) { foreach($a as $key => $val) { unset($GLOBALS[$key]); } return serialize($a); } unset_all_vars(get_defined_vars()); ?> you can also save than a serialized var of the "memory" and perhaps store this in a temporary file.. very usefull if you work with text files and/or file uploads when you've got very large variables. greetz ---- Manual Page -- http://www.php.net/manual/en/function.unset.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39397 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39397&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39397&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64249) next »