Associative array syntax question?
| From: | troels knak-nielsen | Date: | Wed, 24 Sep 2008 12:04:08 +0000 |
| Subject: | Associative array syntax question? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-40661@lists.php.net to get a copy of this message | ||
I just realised that his is valid PHP:
<?php
var_dump(
array(
'foo' => 42,
'foo' => 53));
Producing the following output:
array(1) {
["foo"]=>
int(53)
}
I can anticipate that there may be practical reasons for this
"feature", but I can't think up any scenario, where it wouldn't be a
programming error to statically declare an associative array with the
same key multiple times. Is this a bug or a known quirk? Should I file
a bug-report on it?
--
troels