note 76423 added to language.types.array
| From: | conorj at osu1 dot php dot net | Date: | Sat, 14 Jul 2007 15:34:26 +0000 |
| Subject: | note 76423 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128518@lists.php.net to get a copy of this message | ||
Another note on unquoted array indices. Because it is first interpreted as a constant, it must obey
the naming convention of constants. i.e. a letter or underscore followed by optional letter, digit
and/or underscore characters.
Therefore while the following array declaration is legal:
$a = array('1st'=>'First','2nd'=>'Second');
Trying to access either array item as follows causes an error:
$first = "$a[1st]";
$second = "$a[2nd]";
----
Server IP: 212.108.64.191
Probable Submitter: 84.203.112.14
----
Manual Page -- http://www.php.net/manual/en/language.types.array.php
Edit -- https://master.php.net/note/edit/76423
Del: integrated -- https://master.php.net/note/delete/76423/integrated
Del: useless -- https://master.php.net/note/delete/76423/useless
Del: bad code -- https://master.php.net/note/delete/76423/bad+code
Del: spam -- https://master.php.net/note/delete/76423/spam
Del: non-english -- https://master.php.net/note/delete/76423/non-english
Del: in docs -- https://master.php.net/note/delete/76423/in+docs
Del: other reasons-- https://master.php.net/note/delete/76423
Reject -- https://master.php.net/note/reject/76423
Search -- https://master.php.net/manage/user-notes.php