Re: Why can constants only be scalars?
| From: | Andi Gutmans | Date: | Sun, 09 May 2004 10:13:41 +0000 |
| Subject: | Re: Why can constants only be scalars? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9742@lists.php.net to get a copy of this message | ||
At 03:39 PM 5/8/2004 -0400, Robert Cummings wrote:
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.Yes this is correct. It would not be possible to de reference such constants with object or array syntax. Thus, allowing constants to be defined as such would mean you'd have to assign them to variables before using them. I don't see this as something which should be changed. Definitely not before 5.0 but I'm not sure it's that critical also to change afterwards although it might be possible. Andi