effeciency of global variable vs includes in a function?
Posted: Fri Jun 13, 2003 2:28 pm
Let's say I have a page with 10 functions. Each function uses $IncVar from an included file.
What's a better way of bringing in $IncVar so that that it works as a local scope variable? Should I include the file once at the top of the page, and define $IncVar as a global variable within each function, or should I include the file within each function?
I figure that it probably doesn't make much of a difference if I only use one of the functions. But in my case, I will be using most of the functions in one script. So, I wasn't sure which method would be more effecient.
Just trying to learn what works better. Thanks.
What's a better way of bringing in $IncVar so that that it works as a local scope variable? Should I include the file once at the top of the page, and define $IncVar as a global variable within each function, or should I include the file within each function?
I figure that it probably doesn't make much of a difference if I only use one of the functions. But in my case, I will be using most of the functions in one script. So, I wasn't sure which method would be more effecient.
Just trying to learn what works better. Thanks.