RE: [PHP] Globals and HTTP_SESSION_VARS variables.
| From: | Johnson, Kirk | Date: | Wed, 26 Sep 2001 14:28:52 +0000 |
| Subject: | RE: [PHP] Globals and HTTP_SESSION_VARS variables. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-68865@lists.php.net to get a copy of this message | ||
> Is here anyway to make a variable like $var not the same than
> $HTTP_SESSION_VARS[var], when register_globals=1?. (where
> $var is in the
> script scope).
>
> I read in a changelog that this is relatively recent (make
> $var the same
> than $HTTP_SESSION_VARS[var]).
I'm not sure what was changed. As far as I can see, the global version of
$test and $HTTP_SESSION_VARS["test"] still reference different memory
locations, and they are not the same variable, *while on the current page*.
However, if register_globals is "on", then the global version gets saved to
the session file, and will be in the $HTTP_SESSION_VARS array on the next
page.
<?
session_start();
$test="globalversion";
session_register("test");
$HTTP_SESSION_VARS["test"] = "arrayversion";
echo "global version of test = $test<br>";
echo "sess array version of test =
".$HTTP_SESSION_VARS["test"]."<br>";
?>
Kirk