Re: global variables
| From: | Philip Olson | Date: | Mon, 24 Sep 2001 20:09:10 +0000 |
| Subject: | Re: global variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68595@lists.php.net to get a copy of this message | ||
$bar = 'abc';
function foo() {
global $bar;
$bar = 'def';
}
foo();
echo $bar; // def
http://www.php.net/manual/en/language.variables.scope.php
regards,
Philip Olson
On Tue, 25 Sep 2001, Peter wrote:
> Hi,
>
> I am have a function in which I have created a variable in it called
> $genpassword.
>
> I find that I am unable to carry this variable over to the the other
> scripts to use because it is a local variable and its value exists only in
> the function.
>
> Is there anyway that I can take the value in $genpassword, a local
> variable and change it into a global variable so that other scripts will
> recognize it?
>
> Thanks.
>
> Peter
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>