note 27823 added to language.operators.array
| From: | jeffa at anony dot com | Date: | Thu, 19 Dec 2002 22:03:29 +0000 |
| Subject: | note 27823 added to language.operators.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41137@lists.php.net to get a copy of this message | ||
Just like Perl, the arrow operator => quotes the left hand side, so instead of creating a hash
like so:
$hash = (
'key' => 'value',
'foo' => 'bar'
);
you can save some keystrokes:
(also note the 'extra' comma is valid syntax)
$hash = (
key => 'value',
foo => 'bar',
);
Just beware of reserved tokens like 'class' and 'array' that must be quoted.
--
http://www.php.net/manual/en/language.operators.array.php
http://master.php.net/manage/user-notes.php?action=edit+27823
http://master.php.net/manage/user-notes.php?action=delete+27823
http://master.php.net/manage/user-notes.php?action=reject+27823