Re: associative arrays: usage inside double-quoted strings: documentation gap
| From: | Lars Torben Wilson | Date: | Sat, 10 Mar 2001 00:21:51 +0000 |
| Subject: | Re: associative arrays: usage inside double-quoted strings: documentation gap | ||
| References: | 1 2 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-12146@lists.php.net to get a copy of this message | ||
Jeroen van Wolffelaar writes:
> Note that one of the examples in the real doc uses this syntax!
> (in http://www.php.net/manual/en/language.types.array.php)
> $a[3]['bar'] = 'Bob';
> echo "This will work: " . $a[3][bar];
>
> But you're right, this should not work, because it can be ambibious.
Well, it should work--it is just bad practice. When someone comes
along and isn't using quotes and does something like $arr[default] we
invariably get questions because 'default' is a keyword and it screws
up the script.
> If i make an update for that page, will it be committed? I understand
Probably. Do you have a copy of the doc sources?
> you don't have the time (for now) to do it yourself, while these
Yeah, but there are a bunch of folks working on the docs, so someone
would get to it.
> basic-syntax things are IMHO quite important to be documented correctly,
> even
> more because it is quite strange how this behaves.
>
> The curly brace behavior is even worse documented.
Yup.
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Adcore Finland|
|http://www.coastnet.com/~torben http://www.adcore.com|
|Ph: 1.604.709.0506 torben@adcore.com|
+----------------------------------------------------------------+