note 21524 deleted from function.session-register by sniper
| From: | sniper@php.net | Date: | Thu, 31 Oct 2002 00:49:16 +0000 |
| Subject: | note 21524 deleted from function.session-register by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-38790@lists.php.net to get a copy of this message | ||
As of PHP 4.2.0 a variable must be global not only for registering them inside a function but for
session_start() to set them inside a function too. Example:
// Somewhere.
session_register("aVariable");
// Another php file latter on.
function foo() {
session_start();
if(!isset($aVariable)) {
echo("Unset");
}
Will return Unset... you need to global it:
// Another php file latter on.
function foo() {
global $aVariable;
session_start();
if(!isset($aVariable)) {
echo("Unset");
}
Will not return (print) anything so the variable is correctly set.