note 107718 deleted from function.array-merge by cmb
| From: | cmb@php.net | Date: | Mon, 28 Jan 2019 14:28:56 +0000 |
| Subject: | note 107718 deleted from function.array-merge by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210127@lists.php.net to get a copy of this message | ||
Note Submitter: izhar_aazmi at gmail dot com
----
The problem that the array keys are reindexed, and further not working on array values of type
object or other mixed types.
Simply, I did this:
<?php
foreach($new as $k => $v)
{
$old[$k] = $v;
}
// This will overwrite all values in OLD with any existing
// matching value in NEW
// And keep all non matching values from OLD intact.
// No reindexing, and complete overwrite
/// Working with all kind of data
?>