Re: Associative array syntax question?
| From: | Jani Taskinen | Date: | Wed, 24 Sep 2008 12:09:39 +0000 |
| Subject: | Re: Associative array syntax question? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-40662@lists.php.net to get a copy of this message | ||
troels knak-nielsen wrote:
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?
Expected behaviour.
--Jani