However, I'm still mystified as to why unset($_SESSION) not only doesn't remove old data from the sesison file when the script exits, but prevents the new variable I create after that from being saved.
Perhaps $_SESSION as created by PHP is special and is tied to the session storage, whereas if it is destroyed with unset and then recreated that link is lost. That would explain the behavior.
My guess is that what unset does in 'unlinks' the data from the variable, but it doesn't destroy it. The garbage collection routine in PHP destroys the values when it sees that they aren't connected to a variable. When you unset($_SESSION) you lose the name $_SESSION for that data (effectively killing youra bility to modify session vars), but the data is still kept tied to the session internally in PHP. When you do $_SESSION['newVar'] = 'newVal'; after that, you're creating an all-new variable called $_SESSION that has nothing to do with the actual session data.
-- paperCrane <Justin Patrin>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php