note 53683 added to function.session-register
| From: | DavidB dot at osu1 dot php dot net | Date: | Thu, 09 Jun 2005 04:38:35 +0000 |
| Subject: | note 53683 added to function.session-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90152@lists.php.net to get a copy of this message | ||
Note that with the existence of both $_SESSION and references, it is not necessary to use
register_globals() if you don't want your code cluttered up with references to the $_SESSION
superglobal. Just do something like:
$_SESSION['some_variable'] =& $GLOBALS['some_variable'];
And henceforth you can just use $some_variable and forget all about typing $_SESSION all the time.
Though on subsequent sessions if you want to get at that value with a global variable in a similar
fashion, you'll of course have to use:
$GLOBALS['some_variable'] =& $_SESSION['some_variable'];
It's fairly easy to take that knowledge and come up with a user-defined function that does 90+%
of what the old session_register() did...
----
Manual Page -- http://www.php.net/manual/en/function.session-register.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53683
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53683&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53683&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53683&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53683&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53683&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53683&report=yes
Search -- http://master.php.net/manage/user-notes.php