note 23213 added to function.unset

From: Date: Thu, 11 Jul 2002 20:54:01 +0000
Subject: note 23213 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-32927@lists.php.net to get a copy of this message
To unregister session variables you can use session_unregister('var')) instead of unset($_SESSION['var']) - which does not work (at least in PHP 4). Note that the session var does not show a value until the page has been submitted. check it out: <? session_start(); if (!isset($_SESSION['count'])) { echo "not yet set<br>"; $_SESSION['count'] = 1; echo $count; } else $_SESSION['count']++; if($_SESSION['count'] > 3) session_unregister('count'); ?> <html> <body> <form name="form1" action="session_test.php" > <? echo "count = $count<br>"; ?> <input type="submit" value="submit" > </form> </body> </html> -- http://www.php.net/manual/en/function.unset.php http://master.php.net/manage/user-notes.php?action=edit+23213 http://master.php.net/manage/user-notes.php?action=delete+23213 http://master.php.net/manage/user-notes.php?action=reject+23213

« previous php.notes (#32927) next »