ayok Posted November 13, 2010 Share Posted November 13, 2010 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 Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 13, 2010 Share Posted November 13, 2010 array_merge() takes an unlimited number of arrays: $merged_array = array_merge($array1, $array2, $array3, $array4, $array_etc); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.