Re: Why can constants only be scalars?
| From: | Sara Golemon | Date: | Sat, 08 May 2004 16:35:13 +0000 |
| Subject: | Re: Why can constants only be scalars? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9738@lists.php.net to get a copy of this message | ||
> > I always thought constants were about imposing an
> > unchanging nature to
> > the data and not about visual aesthetics when
> > reading code :/ I too
> > would like to see constant support of non-scalar
> > values.
>
>
> Same here. I have a number of static arrays that I use
> for reference data that are usually encapsulated in a
> function, or a global / session variable. It would be
> very handy to be able to define a constant array
> instead.
>
Whoa... easy, don't go putting words in my mouth...
I never said I wanted constants to allow arrays/objects, just wanted to
understand the reasoning which Andi explained well. I also had an a-ha
moment over breakfast: A constant array would require the allowance of
syntax like echo FOO[0]; which is, for my part, ugly.
-Sara