Re: merging arrays quickly
| From: | Reuben D Budiardja | Date: | Fri, 17 Aug 2001 13:40:09 +0000 |
| Subject: | Re: merging arrays quickly | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63182@lists.php.net to get a copy of this message | ||
Take a look at the function array_merge
http://www.php.net/array_merge
Reuben D. B
On Friday 17 August 2001 08:46 am, you wrote:
> say I have
> $array1 = array("name"=>NULL,"thread"=>NULL,"id"=>NULL);
> $array2 =
> array("0"=>"fred","1"=>"3","2"=>"9999");
>
> I want $array1 to have the values of array2 - or $array2 to hve the keys
> of $array1
> A foreach loop works fine to do this - but I was wondering if there is a
> quicker way to merge the values of one array to another array.