note 64508 deleted from ref.array by bjori
| From: | bjori@php.net | Date: | Mon, 17 Apr 2006 12:12:28 +0000 |
| Subject: | note 64508 deleted from ref.array by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-108315@lists.php.net to get a copy of this message | ||
Note Submitter: michal dot fabry at hladat dot sk
Reason: bad code
----
small function to add $array_add to $array_source.
example:
$array_one = array("a", "b", "c");
$array_two = array("p", "s", "e");
array_join($array_one, $array_two);
result:
array("a", "b", "c", "p", "s", "e");
function array_join(&$array_source, $array_add, $reserve_keys = false) {
foreach($array_add AS $key => $value) {
if($reserve_keys) { // WARNING: values in array_source with same keys will be overwritten!
$array_source[$key] = $value;
} else {
$array_source[] = $value;
}
}
return $array_source;
}