note 27182 added to language.types.array
| From: | t dot kloppenburg at billiton dot de | Date: | Tue, 26 Nov 2002 11:19:58 +0000 |
| Subject: | note 27182 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39989@lists.php.net to get a copy of this message | ||
When you have to extend an array like those in example 7-4 or 7-10, you always have to double check
if there's a comma after every line but the last.
That's annoying.
Some day I discovered that it is possible to write a comma even after the last element, so you can
just copy&paste array element lines without the comma-trouble:
$a_fields = array(
"foo" => "bar",
"yellow" => "green",
"fish" => "banana", /* with comma! :) */
);
I really hope, the php parser doesn't think this is an syntax error in some future versions...
--
http://www.php.net/manual/en/language.types.array.php
http://master.php.net/manage/user-notes.php?action=edit+27182
http://master.php.net/manage/user-notes.php?action=delete+27182
http://master.php.net/manage/user-notes.php?action=reject+27182