Re: Problem with variables
| From: | Tamara Temple | Date: | Sat, 29 Jun 2013 01:16:27 +0000 |
| Subject: | Re: Problem with variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321518@lists.php.net to get a copy of this message | ||
Fernando A <soporteallpurpose@gmail.com> wrote:
> I am working with php and codeigniter, but I have not yet experienced.
> I need create a variable that is available throughout system.
> This variable contains the number of company and can change.
> as I can handle this?
Hi, Fernando, welcome. I'm just a little unsure what you mean by "number
of company" -- is this a count, as in 10 companies, or is it a phone
number, or is it something else?
Jim's reply is workable -- storing session values is quite useful, but
sessions are tied to a specific browser client/ip, and I'm not sure
that's what you want/need here.
If you are looking for setting a global variable that will be available
everywhere in your application, you can use $GLOBALS, or set it from the
very top level context of the application. Given you're using
CodeIgniter, which sadly I am not versed in, you may need to set it with
$GLOBALS:
$GLOBALS['my_var'] = 10; // whatever you need to do here
When you say it changes, how and when exactly does it change?