note 30265 added to ref.session
| From: | Devin at rack1 dot php dot net | Date: | Wed, 12 Mar 2003 17:08:55 +0000 |
| Subject: | note 30265 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45157@lists.php.net to get a copy of this message | ||
It appears that you cannot really mix and match the old and new ways of registering session
variables.
old:
register_globals = ON
$name = 'John Smith';
session_register ('name');
new:
register_globals = OFF
$_SESSION['name'] = 'John Smith';
with register_globals = ON any changes to a global variable will effect the $_SESSION array when the
session is reloaded:
<?
// register_globals = ON
session_start ();
$_SESSION['test'] = 'this is a test';
$test = strtoupper ($test);
print_r ($_SESSION);
?>
When this script is run and then refreshed (reload the session) $_SESSION['test'] will
equal 'THIS IS A TEST'
--
http://www.php.net/manual/en/ref.session.php
http://master.php.net/manage/user-notes.php?action=edit+30265
http://master.php.net/manage/user-notes.php?action=delete+30265
http://master.php.net/manage/user-notes.php?action=reject+30265