RE: [PHP] Session variable scope - surprise!
| From: | Richard Fox | Date: | Mon, 04 Mar 2002 15:25:59 +0000 |
| Subject: | RE: [PHP] Session variable scope - surprise! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87102@lists.php.net to get a copy of this message | ||
OK, but then how do you explain:
<?php
function reg() {
$test = 13;
session_register("test");
echo "in reg(), test=<$test><br>";
}
global $HTTP_SESSION_VARS;
session_start();
reg();
if (session_is_registered("test")) {
$tt = $HTTP_SESSION_VARS["test"];
echo "session variable test=<$tt><br>";
}
else
echo "You really don't know what you're doing, do you?<br>";
?>
This still gives me the output:
in reg(), test=<13>
session variable test=<>
Aaargh!