[snip]
So your telling me that all variables defined in the global scope are
automatically added to the $_SESSION array...?
Not true I think....
[/snip]

You're right of course. I went back to your original code and stripped
it back some

<?php
session_start();
$test = -1;

echo $_SESSION['test']."\n";

$test = 999;
$_SESSION['test'] = $test;

echo $_SESSION['test']."\n";



?>
The logic is incorrect, when you reload the page $test gets set to -1
before your echo statement. After your echo statement it gets set to
999. On reload it again gets set to -1 before your echo. The second echo
is always right (for what you want). If you comment out $test = -1; both
echos come back correctly. Since you have declared $_SESSION['test']
once and the session is still in effect on the reload the first echo
comes back -1 since that is what the declared variable is now worth.
Make sense?

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

Reply via email to