note 27823 deleted from language.operators.array by didou
| From: | didou@php.net | Date: | Sun, 22 Feb 2004 03:04:23 +0000 |
| Subject: | note 27823 deleted from language.operators.array by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65503@lists.php.net to get a copy of this message | ||
Note Submitter: jeffa@anony.com
----
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.