note 30206 rejected from ref.session by jsheets
| From: | jsheets@php.net | Date: | Tue, 11 Mar 2003 05:39:07 +0000 |
| Subject: | note 30206 rejected from ref.session by jsheets | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-45090@lists.php.net to get a copy of this message | ||
If register_globals is Off and you want to use $_SESSION['variable_name'], inside a
function you MUST declare $_SESSION global BEFORE session_start.
Otherwise it will not work (I currently use PHP 4.3)
so
function something() {
global $_SESSION;
session_start();
$_SESSION['variable_name']++;
}
and NOT
// won't work
session_start();
function something() {
global $_SESSION;
$_SESSION['variable_name']++;
}