note 36943 deleted from function.unset by didou

From: Date: Tue, 28 Oct 2003 10:08:26 +0000
Subject: note 36943 deleted from function.unset by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59414@lists.php.net to get a copy of this message
Note Submitter: PHP astronaut ---- This is for anyone else going mad over unsetting session variables. I was going insane using the following code: $varsToUnset = array('foo1','foo2','foo3') foreach($varsToUnset as $var) { if(isset($_SESSION[$var])) { $_SESSION[$var] = null; unset($_SESSION[$var]); } } My session variables were still there! Surely a PHP bug? In fact getting rid of the unset($_SESSION[$var]) has now sorted this out.

« previous php.notes (#59414) next »