note 25233 added to function.session-register

From: Date: Sun, 15 Sep 2002 19:54:50 +0000
Subject: note 25233 added to function.session-register
Groups: php.notes 
Request: Send a blank email to php-notes+get-36710@lists.php.net to get a copy of this message
For some odd reason, this will not work: function my_function() { // do lots of stuff global $_SESSION; $_SESSION['foo'] = 'bar'; } The variable won't be registered as a session variable, but that's not all - the session data file will be EMPTY, and SID won't be defined. (And I know you don't need to declare $_SESSION as global, but if you want your script to work on lower versions of PHP you probably want to do something like $_SESSION = &$HTTP_SESSION_VARS; and then you can't rely on the array to be "super global".) -- http://www.php.net/manual/en/function.session-register.php http://master.php.net/manage/user-notes.php?action=edit+25233 http://master.php.net/manage/user-notes.php?action=delete+25233 http://master.php.net/manage/user-notes.php?action=reject+25233

« previous php.notes (#36710) next »