Funnily - doesn't work for me. Here's what I got:
Script #1
#!/usr/local/bin/php
<?php
session_start();
if (!isset($count)) { echo "Setting count"; session_register("count"); }
else echo $count;
$count++;
sleep(60);
?>
Script #2
#!/usr/local/bin/php
<?php
session_start();
echo $count;
?>
If I start script#1 (and it sleep()s), wait 10 seconds, then launch script
#2 in a separate browser window, script #2 returns empty. However once the
sleep() is completed and I refresh the window with script #2, the output is
okay (1).
Why does this happen?
Nikhil
""Johnson, Kirk"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > -----Original Message-----
> > From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]
>
> > When does a session variable become available? Immediately after the
> > session_register command or after the script ends?
>
> Immediately after it is assigned.
>
> > And if the commands are as follows:
> >
> > session_start();
> > session_register("hello");
> > $hello=3;
> >
> > will the session variable $hello be set to 3 or do I have to
> > add another
> > session_register() call after changing the value?
>
> No additional calls are needed. You will need to do session_start() on the
> next page if you want to access $hello there.
>
> Kirk
>
> --
> 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]