note 31852 added to function.array-merge

From: Date: Tue, 06 May 2003 17:28:48 +0000
Subject: note 31852 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-47589@lists.php.net to get a copy of this message
Hey, looking for a way to do this, not sure off the top of my head. $array1 = array ("Apples" => "4", "Oranges" => "3", "Bananas" => "5"); $array1 = array ("Apples" => "2", "Oranges" => "4", "Bananas" => "1"); $result = array_merge ($array1, $array2); And I want $result to be the key name with the values added together. Like this... Array ( [Apples] => 6 [Oranges] => 7 [Bananas] => 6 ) Any idea off of the tops of your heads? -- http://www.php.net/manual/en/function.array-merge.php http://master.php.net/manage/user-notes.php?action=edit+31852 http://master.php.net/manage/user-notes.php?action=delete+31852 http://master.php.net/manage/user-notes.php?action=reject+31852

« previous php.notes (#47589) next »