note 64508 added to ref.array
| From: | michal dot fabry at hladat dot sk | Date: | Mon, 17 Apr 2006 10:17:00 +0000 |
| Subject: | note 64508 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-108307@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 62.65.181.66
Probable Submitter: 85.216.183.79
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- http://master.php.net/note/edit/64508
Del: integrated -- http://master.php.net/note/delete/64508/integrated
Del: useless -- http://master.php.net/note/delete/64508/useless
Del: bad code -- http://master.php.net/note/delete/64508/bad+code
Del: spam -- http://master.php.net/note/delete/64508/spam
Del: non-english -- http://master.php.net/note/delete/64508/non-english
Del: in docs -- http://master.php.net/note/delete/64508/in+docs
Del: other reasons-- http://master.php.net/note/delete/64508
Reject -- http://master.php.net/note/reject/64508
Search -- http://master.php.net/manage/user-notes.php