note 106861 added to function.array-merge

From: Date: Tue, 13 Dec 2011 10:32:01 +0000
Subject: note 106861 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-185062@lists.php.net to get a copy of this message
A simpler way to achieve the "merge arrays WITHOUT REINDEXING numerical keys and WITH OVERWRITING" of the ventzy dot public at gmail dot com post of 07-Dec-2011 is: $result = $array2 + $array1; which gives the same result as $result = array_diff_key($array1, $array2) + $array2; albeit with the keys in a different order, as explained in the post of w_barath at hotmail dot com 04-Oct-2011 below. The point to note is that the array to do the overwriting must be the one on the left of the + operator. ---- Server IP: 81.92.192.129 Probable Submitter: 206.214.15.246 ---- Manual Page -- http://www.php.net/manual/en/function.array-merge.php Edit -- https://master.php.net/note/edit/106861 Del: integrated -- https://master.php.net/note/delete/106861/integrated Del: useless -- https://master.php.net/note/delete/106861/useless Del: bad code -- https://master.php.net/note/delete/106861/bad+code Del: spam -- https://master.php.net/note/delete/106861/spam Del: non-english -- https://master.php.net/note/delete/106861/non-english Del: in docs -- https://master.php.net/note/delete/106861/in+docs Del: other reasons-- https://master.php.net/note/delete/106861 Reject -- https://master.php.net/note/reject/106861 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185062) next »