On Tue, 2002-03-12 at 14:38, David Johansen wrote:
> I have a little chunk of code that checks to see if a variable exists and if
> not then it sets it. It goes like this:
> if (empty($page))
> {
>    $page = "login";
> }
> I then end that part of the php script after doing what I need to. Then I
> start up again on the same html page and I assumed that $page had a value
> assigned to it because of the above code, but it appears that it doesn't. Is
> this supposed to happen or is something weird happening. I added that little
> bit of code to the second chunk of code and it fixed the problem. Is that
> the "right" way to do it? Is that variable only available in the <?php ?>
> that it's declared in? Thanks,
> Dave

Shouldn't be. A variable is valid from the point it's declared until 
it's unset(), or goes out of scope (the function within which it was
declared ends), or the script ends. 

Can you provide a short script which exhibits this behaviour?

 Torben Wilson <[EMAIL PROTECTED]>

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

Reply via email to