Re: [PHP] Re: make global variables accessible to functions?

2006-04-08 Thread Rory Browne
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

[PHP] Re: make global variables accessible to functions?

2006-04-07 Thread El Bekko
Bing Du wrote: Hello, We use PHP 4.3.9. 'register_globals = Off' is set in php.ini. I've heard using 'global' could cause security problems. Is using $GLOBALS still not more secure than using the 'global' keyword? How should function foo() obtain the value of $a? ?php $a = 'one';

Re: [PHP] Re: make global variables accessible to functions?

2006-04-07 Thread Bing Du
Thanks for the response. That way is secure and has nothing to do with register_globals ;) Good. That's what I wanted to hear. I know by default some pre-defined global variables can be accessed through $GLOBALS. If I don't want end users to add their own user defined variables in the

Re: [PHP] Re: make global variables accessible to functions?

2006-04-07 Thread tedd
At 12:35 PM -0500 4/7/06, Bing Du wrote: Thanks for the response. That way is secure and has nothing to do with register_globals ;) Good. That's what I wanted to hear. I know by default some pre-defined global variables can be accessed through $GLOBALS. If I don't want end users to add