Re: Passing vars between functions (with POSTs)
| From: | Rasmus Lerdorf | Date: | Wed, 16 May 2001 18:29:12 +0000 |
| Subject: | Re: Passing vars between functions (with POSTs) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53089@lists.php.net to get a copy of this message | ||
> I've tried other ways but my problem still continues... I can not pass
> $login var out of the function.
>
> I don't have this problem in the two previous functions because I pass this
> variable as function argument, but this last function that doesn't have
> arguments I can't see the $login (even if is setup on the previous function
> as global). I don't know why I PHP doesn't allow to setup a $login as global
> to all functions (this will solve this problem).
It does. You simply have to declare in the function you wish to access
the global variable that you want the global variable by using the global
keyword in that function.
Please read the Variables Scope chapter in the manual:
http://php.net/manual/en/language.variables.scope.php
-Rasmus