Jump to content

array_merge


ayok

Recommended Posts

Hi,

 

I failed to merge arrays. This is the case.

$arraylength= 2;
for($i=0;$i<$arraylength;$i++){
  $vars[] = array(
        $key1[$i] => $value1[$i], 
        $key2[$i] => $avalue2[$i], 
        $key3[$i] => $avalue3[$i]);
}
print_r($vars);

I got then, for example, this output

Array(
  [0] => Array ( [key0] => value1, [key0] => value1, [key2] => value2 ) 
  [1] => Array ( [key10] => value10, [key11] => value11, [key12] => value12 ) 
)

 

Then I need to merge those two arrays. It should be like array_merge($vars[0],$vars[1]);, but how can i merge more arrays?

 

Thank you in advanced,

ayok

Link to comment
https://forums.phpfreaks.com/topic/218562-array_merge/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.