Re: Array Problem
| From: | Salah Faya | Date: | Thu, 24 Apr 2003 10:06:02 +0000 |
| Subject: | Re: Array Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145132@lists.php.net to get a copy of this message | ||
function array_d_merge(&$target, $source) {
foreach($source as $key=>$val) {
$newArray[$key][]=$val;
}
}
$array1 = array ('string1'=>'value1')
$array2 = array ('string1'=>'blah')
$newArray = array();
array_d_merge(&$newArray, $array1);
array_d_merge(&$newArray, $array2);
var_dump($newArray);
----- Original Message -----
From: "Yamin Prabudy" <phplist@pro.net.id>
To: <php-general@lists.php.net>
Sent: Wednesday, April 23, 2003 8:51 PM
Subject: [PHP] Array Problem
> Hi there
>
> I got 2 array say
>
> Array (
> [string1] =>Value1
> [string2] =>Value2
> [string3] =>Value3
> )
>
> Array(
> [string1] =>Blah
> [string2] =>Bleeeeh
> [string3] = BOoooOh
> )
>
>
> how can I join this 2 array into one becoming multi dimension
> so the string1 will have Value1 and Blah , so on
>
> Yamin Prabudy
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>