so your trying to take a list of variables and register them as session vars? <?php function make_session($vars) { $vars = explode('|', $vars); foreach($vars as $pos => $val) { global $val; session_register($val); } } ?> this will work for that. -- Chris Lee [EMAIL PROTECTED] ""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message 99dn35$duo$[EMAIL PROTECTED]">news:99dn35$duo$[EMAIL PROTECTED]... 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]