note 34582 deleted from function.array-push by irchtml
| From: | irchtml@php.net | Date: | Tue, 24 Feb 2004 08:58:36 +0000 |
| Subject: | note 34582 deleted from function.array-push by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65633@lists.php.net to get a copy of this message | ||
Note Submitter: vitale@students.math.unifi.it
----
Just to correct example posted by "daevid at daevid dot com" on 14-Mar-2003 01:52.
array_merge renumber numeric keys, thus the key may not be mantained.
Try this code:
function addArray(&$array, $key, $val)
{
$tempArray = array($key => $val);
$array = $array + $tempArray;
}