This is a behavior I have not found documented, in fact the books I have
read indicated that this would not be the case...

given the script (with session.save_handler = files):

<?php

function reg() {
   $test = 13;
   session_register("test");
   echo "in reg(), test=<$test><br>";
   }

session_start();
reg();
echo "test=<$test><br>";

?>

The output is:

in reg(), test=<13>
test=<>

I was quite surprised, but at least now I know why my code isn't working. I
assume that $test is going out of scope after the function reg() exits. BUT,
isn't registering a variable as a session variable supposed to give it
"superglobal" status? I thought so.  Can someone give me the 'official'
explanation of this behavior?

Many thanks,

Richard


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to