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):


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

echo "test=<$test><br>";


The output is:

in reg(), test=<13>

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,


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to