note 107718 added to function.array-merge
| From: | izhar_aazmi at gmail dot com | Date: | Tue, 28 Feb 2012 20:54:54 +0000 |
| Subject: | note 107718 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186419@lists.php.net to get a copy of this message | ||
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:
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
----
Server IP: 69.147.83.197
Probable Submitter: 125.19.192.30
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- https://master.php.net/note/edit/107718
Del: integrated -- https://master.php.net/note/delete/107718/integrated
Del: useless -- https://master.php.net/note/delete/107718/useless
Del: bad code -- https://master.php.net/note/delete/107718/bad+code
Del: spam -- https://master.php.net/note/delete/107718/spam
Del: non-english -- https://master.php.net/note/delete/107718/non-english
Del: in docs -- https://master.php.net/note/delete/107718/in+docs
Del: other reasons-- https://master.php.net/note/delete/107718
Reject -- https://master.php.net/note/reject/107718
Search -- https://master.php.net/manage/user-notes.php