note 37942 added to ref.array
| From: | mikething at rn2 dot php dot net | Date: | Tue, 02 Dec 2003 22:47:17 +0000 |
| Subject: | note 37942 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61293@lists.php.net to get a copy of this message | ||
There is no built in way to concatenate (join together) two arrays. really annoying oversight.
Here's a function:
function concat($first,$second) {
foreach ($second as $i=>$val)array_push($first,$val);
return $first;
}
so that...
$arr1 = array("hello");
$arr2 = array("momma");
$arr3 = concat($arr1,$arr2);
makes arr3 become array("hello","momma")
This function doesn't deal with keys tho. check this out...
http://forums.devshed.com/archive/5/2001/1/4/10096
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37942
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37942&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37942&report=yes
Search -- http://master.php.net/manage/user-notes.php