[PHP] Re: Wicked, Array add problem!
Uhm found a solution for my own problem somewere else on this list.. credits go2 Andrey Hristov ? echo pre; $array1 = array(text=array(posted=Posted by,source=Bron)); $array2 = array(text=array(posted=Posted by1)); print_r($array1); print_r($array2); function array_overlay($ar1,$ar2){ foreach ($ar2 as $k=$v){ if (isset($ar1[$k]) is_array($ar1[$k]) is_array($ar2[$k]) ) array_overlay($ar1[$k],$ar2[$k]); elseif (!isset($ar1[$k])) $ar1[$k]=$v; } } print_r(array_overlay($array2,$array1)); echo print_r($array2); echo /pre; ? Emile Bosch [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I was wondering if someone could help me with the following problem I want to add values to an array, overwriting the existing ones and keeping the original intact. array 1 looks like: text posted = Posted by source = Bron array 1 looks like: text posted = Posted by1 Now i would like to have the following result: text posted = Posted by1 source = Bron Like an OVerlay array 2 over array 1 function or something.. Please can someone help me? Warm regards, Emile Bosch ? echo pre; $array1 = array(text=array(posted=Posted by,source=Bron)); $array2 = array(text=array(posted=Posted by1)); print_r($array1); print_r($array2); print_r(array_merge($array1,$array2)); /* I was hoping that this below would turn out but that is not the issue what function must i use to get this result?? Array ( [text] = Array ( [posted] = Posted by1 [source] = Bron ) ) */ echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Wicked, Array add problem!
I was wondering if someone could help me with the following problem I want to add values to an array, overwriting the existing ones and keeping the original intact. array 1 looks like: text posted = Posted by source = Bron array 1 looks like: text posted = Posted by1 Now i would like to have the following result: text posted = Posted by1 source = Bron Like an OVerlay array 2 over array 1 function or something.. Please can someone help me? Warm regards, Emile Bosch ? echo pre; $array1 = array(text=array(posted=Posted by,source=Bron)); $array2 = array(text=array(posted=Posted by1)); print_r($array1); print_r($array2); print_r(array_merge($array1,$array2)); /* I was hoping that this below would turn out but that is not the issue what function must i use to get this result?? Array ( [text] = Array ( [posted] = Posted by1 [source] = Bron ) ) */ echo /pre; ? Emile Bosch [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I was wondering if someone could help me with the following problem I want to add values to an array, overwriting the existing ones and keeping the original intact. array 1 looks like: text posted = Posted by source = Bron array 1 looks like: text posted = Posted by1 Now i would like to have the following result: text posted = Posted by1 source = Bron Like an OVerlay array 2 over array 1 function or something.. Please can someone help me? Warm regards, Emile Bosch ? echo pre; $array1 = array(text=array(posted=Posted by,source=Bron)); $array2 = array(text=array(posted=Posted by1)); print_r($array1); print_r($array2); print_r(array_merge($array1,$array2)); /* I was hoping that this below would turn out but that is not the issue what function must i use to get this result?? Array ( [text] = Array ( [posted] = Posted by1 [source] = Bron ) ) */ echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]