note 72173 added to function.array-merge

From: Date: Fri, 05 Jan 2007 16:11:40 +0000
Subject: note 72173 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-121324@lists.php.net to get a copy of this message
/* ADDS ALL KEYS OF $arr2 THAT ARE NOT IN $arr1 IT KEEPS ALL VALUES OF $arr1 IF THEY EXISTS, ELSE IT SAVES VALUES OF $arr2 */ function array_add_keys($arr1, $arr2) { foreach($arr2 as $k=>$v) { if (!array_key_exists($k, $arr1)) { // K DOESN'T EXIST // $arr1[$k]=$v; } else { // K EXISTS // if (is_array($v)) { // IF K IS AN ARRAY, I ADD THE ELEMENTS // $arr1[$k]=array_unisci_chiavi($arr1[$k], $arr2[$k]); } } } return $arr1; } ---- Server IP: 66.163.161.117 Probable Submitter: 217.133.35.137 ---- Manual Page -- http://www.php.net/manual/en/function.array-merge.php Edit -- https://master.php.net/note/edit/72173 Del: integrated -- https://master.php.net/note/delete/72173/integrated Del: useless -- https://master.php.net/note/delete/72173/useless Del: bad code -- https://master.php.net/note/delete/72173/bad+code Del: spam -- https://master.php.net/note/delete/72173/spam Del: non-english -- https://master.php.net/note/delete/72173/non-english Del: in docs -- https://master.php.net/note/delete/72173/in+docs Del: other reasons-- https://master.php.net/note/delete/72173 Reject -- https://master.php.net/note/reject/72173 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121324) next »