Register session in function without global?
| From: | Tobias Talltorp | Date: | Thu, 22 Mar 2001 20:34:30 +0000 |
| Subject: | Register session in function without global? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45178@lists.php.net to get a copy of this message | ||
I am trying to register a session variable in a function without using the
global in the beginning.
The reason for this is that I don´t always know how many variables I am
going to register (I separate the different fields with | like this,
"username|email|cellphone" and explode them).
Is there some way I can make all the variables in the function global, so I
can get the session variables registered?
function test() {
global $username // <-- With this, it works. Without it, it doesn´t
session_start();
$username="tobias";
session_register("username");
}
The best I could come up with was (didn´t work):
global $HTTP_SESSION_VARS;
Any thoughts?
// Tobias