Re: [PHP] Global or include?

2011-01-06 Thread Peter Lind
On Jan 6, 2011 4:24 PM, "Sándor Tamás" 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 look like as the in

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 ke

Re: [PHP] Global or include?

2011-01-05 Thread David Harkness
On Wed, Jan 5, 2011 at 3:27 PM, Nathan Nobbe 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 and add functions

Re: [PHP] Global or include?

2011-01-05 Thread Nathan Nobbe
On Wed, Jan 5, 2011 at 4:27 PM, Nathan Nobbe wrote: > On Wed, Jan 5, 2011 at 3: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

Re: [PHP] Global or include?

2011-01-05 Thread Nathan Nobbe
On Wed, Jan 5, 2011 at 3: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 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

[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 'glo