note 4179 deleted from function.array-merge by sniper
| From: | sniper@php.net | Date: | Mon, 06 Oct 2003 22:56:28 +0000 |
| Subject: | note 4179 deleted from function.array-merge by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57928@lists.php.net to get a copy of this message | ||
Note Submitter: david@audiogalaxy.com
----
See my posts about array_reverse. Key values are actually always 'associative' - i.e.
there's not some different flavor of array when you start to use strings instead of numbers or
start to use numbers out of order. So, how exactly would you like functions like array_merge to
distinguish the situations where you want to keep the associations from the (probably much more
prevalent) situations where people just want to concatenate two arrays. Most people aren't
thinking "$B[0] should replace $A[0], $B[1] should replace $A[1], ... ". I think the
distinction it does make - merge if the keys are strings, concatenate if the keys are numbers - is
fair. Maybe there should really be separate functions for these two processes.