Re: How to store data that doesn't change?
| From: | Peter Lind | Date: | Wed, 15 Sep 2010 12:49:17 +0000 |
| Subject: | Re: How to store data that doesn't change? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308099@lists.php.net to get a copy of this message | ||
On 15 September 2010 14:46, Peter van der Does <pvanderdoes@gmail.com> wrote:
> Hi,
>
> How do you people store data that doesn't change, an example of this
> would be the version number of your software. You might want to use it
> through out your program but how to you store it?
>
> As far as I can see there are several options to use this data.
> 1. Global Variable
> 2. Store it in a registry class
> 3. Store it in a named constant.
> 4. Use a function that will return the data (kind of like a regsitry
> class but it's not a class)
>
> Personally I don't like option 1 but what about the other options. Is
> any of them faster then the others. What other pros and cons are there.
>
3. Constant, as long as you're dealing with scalars.
Regards
Peter
--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>