Re: Re: make global variables accessible to functions?
| From: | Rory Browne | Date: | Sat, 08 Apr 2006 10:54:36 +0000 |
| Subject: | Re: Re: make global variables accessible to functions? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233537@lists.php.net to get a copy of this message | ||
I have to agree with passing them as opposed to accessing them from inside
the function
Clean
$a = "whatever";
function foo($a){
echo $a;
}
Ugly
$a = "whatever";
function foo(){
global $a;
echo $a;
}
Unless the variables in question are for all intents and purposes constant (
real constants can't be arrays ), ie for example configuration vars, I would
avoid making them global.
Having that said, it's your code......