Re: $a{} stuff
| From: | Rasmus Lerdorf | Date: | Sat, 03 Jan 2004 21:40:35 +0000 |
| Subject: | Re: $a{} stuff | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-6778@lists.php.net to get a copy of this message | ||
On Sat, 3 Jan 2004, Derick Rethans wrote:
> I think this sideeffect should be disallowed as it adds a lot of
> unreadableness to code. (I do als vagely remember a discussion a year or
> something ago which resulted in something like "the offset to a string
> should be an integer only, and not for example {1..4} or {-1}". Can't
> find this though in the archives.
That's a different argument. {1..4} and {-1} both introduce new concepts.
I see no reason why {} cannot contain exactly the same things that [] can
contain today. And if suddenly [] could only contain integers pretty much
every PHP script I have ever written would break. The whole point of {}
is to explicitly differentiate an string index from an array index. How
that index is specified inside the braces shouldn't differ from one to the
other.
-Rasmus