Re: [PHP] Global or include?

2011-01-06 Thread Sándor Tamás
In that case you should use include_once in every script. But if you are absolutely sure that all scripts will be processed, you can include it only in one of them, because PHP - in short terms - does a file include, so it will look like as the included file is part of the script. The global

Re: [PHP] Global or include?

2011-01-06 Thread Peter Lind
On Jan 6, 2011 4:24 PM, Sándor Tamás sandorta...@hostware.hu wrote: In that case you should use include_once in every script. But if you are absolutely sure that all scripts will be processed, you can include it only in one of them, because PHP - in short terms - does a file include, so it will

[PHP] Global or include?

2011-01-05 Thread Paul Halliday
Say you have 10 or so scripts and a single config file. If you have main.php, functions1.php, functions2.php, functions3.php.. Does is hurt to do an include of the config file in each separate script, even if you only need a few things from it, or should you just specify what you want with a

Re: [PHP] Global or include?

2011-01-05 Thread Nicholas Kell
On Jan 5, 2011, at 4:40 PM, Paul Halliday wrote: Say you have 10 or so scripts and a single config file. If you have main.php, functions1.php, functions2.php, functions3.php.. Does is hurt to do an include of the config file in each separate script, even if you only need a few things

Re: [PHP] Global or include?

2011-01-05 Thread Nathan Nobbe
On Wed, Jan 5, 2011 at 3:40 PM, Paul Halliday paul.halli...@gmail.comwrote: Say you have 10 or so scripts and a single config file. If you have main.php, functions1.php, functions2.php, functions3.php.. Does is hurt to do an include of the config file in each separate script, even if you

Re: [PHP] Global or include?

2011-01-05 Thread Nathan Nobbe
On Wed, Jan 5, 2011 at 4:27 PM, Nathan Nobbe quickshif...@gmail.com wrote: On Wed, Jan 5, 2011 at 3:40 PM, Paul Halliday paul.halli...@gmail.comwrote: Say you have 10 or so scripts and a single config file. If you have main.php, functions1.php, functions2.php, functions3.php.. Does is hurt

Re: [PHP] Global or include?

2011-01-05 Thread David Harkness
On Wed, Jan 5, 2011 at 3:27 PM, Nathan Nobbe quickshif...@gmail.com wrote: if($cachedConfig !== null) { // load file and store value(s) in $cachedConfig } No config for you ... one year! Sorry, couldn't resist. :p To expand on Nathan's excellent strategy, you could go one further