TechniqueUse PHP's session_unregister() function instead of unset() to remove the variable from the session: <?php session_register('somevar'); if (session_is_registered('somevar')) { session_unregister('somevar') or die('Could not unregister somevar'); } ?> CommentsThe session_unregister() function removes the specified variable from the session registry, so that when the session is saved, it will not contain the newly unregistered variable. This function does not delete the variable's contents, however. |