Re: global vars in a function
| From: | CC Zona | Date: | Sat, 30 Mar 2002 05:03:03 +0000 |
| Subject: | Re: global vars in a function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90748@lists.php.net to get a copy of this message | ||
In article <B8CB9012.2D5D%justin@indent.com.au>,
justin@indent.com.au (Justin French) wrote:
> Am I missing something? I'm trying to use vars set in my config.php file in
> a function, and can't seem to do it without using $GLOBALS["varname"]
<snip>
> Is there a way to make global vars available in each function, or is this
> just the way things go?
PHP scope rules are different from C and other languages; you must use the
'global' keyword. See
<http://www.php.net/manual/en/language.variables.scope.php>
for more info.
--
CC