Needed an quick array_merge clone that preserves the keys:
<?
// function array_join
// merges 2 arrays preserving the keys,
// even if they are numeric (unlike array_merge)
// if 2 keys are identical, the last one overwites
// the existing one, just like array_merge
// merges up to 10 arrays, minimum 2.
function array_join($a1, $a2, $a3=null, $a4=null, $a5=null,
$a6=null, $a7=null, $a8=null, $a9=null, $a10=null) {
$a=array();
foreach($a1 as $key=>$value) $a[$key]=$value;
foreach($a2 as $key=>$value) $a[$key]=$value;
if (is_array($a3))
$a=array_join($a,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$a10);
return $a;
}
?>
----
Server IP: 216.235.15.211
Probable Submitter: 64.18.184.17
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- https://master
.php.net/note/edit/69991
Del: integrated -- h
ttps://master.php.net/note/delete/69991/integrated
Del: useless -- http
s://master.php.net/note/delete/69991/useless
Del: bad code -- htt
ps://master.php.net/note/delete/69991/bad+code
Del: spam -- https:/
/master.php.net/note/delete/69991/spam
Del: non-english --
https://master.php.net/note/delete/69991/non-english
Del: in docs -- http
s://master.php.net/note/delete/69991/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/69991
Reject -- https://mast
er.php.net/note/reject/69991
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|