note 92961 added to function.array-merge

From: Date: Sun, 16 Aug 2009 20:02:19 +0000
Subject: note 92961 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-159555@lists.php.net to get a copy of this message
More about the union operator (+)... The "array_unique" that gets applied, is actually based on the keys, not the values. So if you have multiple values with the same key, only the last one will be preserved. <?php $array1[0] = "zero"; $array1[1] = "one"; $array2[0] = 0; $array1[1] = 1; $array3 = $array1 + $array2; // array3 will look like: // array(0=>0, 1=>1) // ie: beware of the latter keys overwriting the former keys ?> ---- Server IP: 72.55.140.6 Probable Submitter: 99.231.215.159 ---- Manual Page -- http://www.php.net/manual/en/function.array-merge.php Edit -- https://master.php.net/note/edit/92961 Del: integrated -- https://master.php.net/note/delete/92961/integrated Del: useless -- https://master.php.net/note/delete/92961/useless Del: bad code -- https://master.php.net/note/delete/92961/bad+code Del: spam -- https://master.php.net/note/delete/92961/spam Del: non-english -- https://master.php.net/note/delete/92961/non-english Del: in docs -- https://master.php.net/note/delete/92961/in+docs Del: other reasons-- https://master.php.net/note/delete/92961 Reject -- https://master.php.net/note/reject/92961 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159555) next »