Re: constant arrays or something like #define in c
| From: | Andrey Hristov | Date: | Thu, 23 Aug 2001 15:28:31 +0000 |
| Subject: | Re: constant arrays or something like #define in c | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64109@lists.php.net to get a copy of this message | ||
You can use define in some main config file which is known by all scripts
of the site.
For example
define ("SESSION_NAME","mysite_sid");
Where you want to use the array
${SESSION_NAME}=array('login'=>'scott',"password"=>"tiger","age"=>"25");
${SESSION_NAME}['login']
or
${SESSION_NAME}['age']
Hope this helps.
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%
----- Original Message -----
From: "Gregor Maier" <gregor.maier@newlogic.com>
To: <php-general@lists.php.net>
Sent: Thursday, August 23, 2001 6:16 PM
Subject: [PHP] constant arrays or something like #define in c
> Hi,
>
> I'm looking for a way to get a constant array or something that is
similiar to
> a #define XYZ abc in C.
>
> I want to be able to do the following:
>
> DEFINE SOMEHOW: abc as XYZ (like #define XYZ abc) where abc is an
> array. So that XYZ is replaced by abc.
>
> so that I can use XYZ[key] in my php-code and that this translates to
abc[key].
>
> Or is there another possibility for this. I wouldn't mind if XYZ is not
> constant as long as can use XYZ instead of abc.
> Would it be possible to do such a thing with references?
>
> Thanks for your help.
>
> Gregor
>
> ----------------------------------
> E-Mail: Gregor Maier <gregor.maier@newlogic.com>
> Date: 23-Aug-2001
> Time: 17:09:14
> ----------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>