associative arrays: usage inside double-quoted strings: documentation gap
| From: | Jeroen van Wolffelaar | Date: | Fri, 09 Mar 2001 23:46:37 +0000 |
| Subject: | associative arrays: usage inside double-quoted strings: documentation gap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12143@lists.php.net to get a copy of this message | ||
Hi there,
'note sended succesfully'... though
it does not appear on the website.
(No caching at all, i'm 100%
certain!)
I think it should be in de real doc.
I'm willing to write it, it will and should be quite short.
(The (a) variant of writing associatad arrays is totally undocumenten, but DOES appear is some
doc-examples. The inside-string variant is also very poorly documented)
Will it then be added? I'm not going
to write something that isn't being added.
<note section=arrays>
Named indices
Note that
a) echo "Value of element foo in array arr is " . $arr[foo]
b) echo "Value of element foo in array arr is " . $arr['foo']
c) echo "Value of element foo in array arr is " . $arr["foo"]
d) echo "Value of element foo in array arr is $arr[foo]"
e) echo "Value of element foo in array arr is $arr['foo']"
f) echo "Value of element foo in array arr is $arr[\"foo\"]"
a-d are equal, but e and f result in a
parse-error!!
</note>
This behaviour (the (un)need for quotes with
named indices) is poorly documented. It only appears in some examples, without
any explanation.
This parse error should be more
explainatory:
Parse error: parse error, expecting `T_STRING' or
T_VARIABLE' or T_NUM_STRING'
Greetz,
Jeroen
University of Utrecht
==========
Jeroen J.A. van Wolffelaar
Email: Jeroen@A-Eskwadraat.nl
Homepage: http://www.A-Eskwadraat.nl/~jeroen
Icq: 33944357
EersteCie: http://www.A-Eskwadraat.nl/eerste - Ik
zou het niet op je eerste date vertellen...
IMo mailinglists moderator: imo2000-owner@egroups.com
==========