Concatenate / merge two arrays
I have two arrays like this, actually this is the mysql data obtained from two different servers:
$array1 = array (
0 => array ( 'id' => 1, 'name' => 'somename') ,
1 => array ( 'id' => 2, 'name' => 'somename2')
);
$array2 = array (
0 => array ( 'thdl_id' => 1, 'otherdate' => 'spmethings') ,
1 => array ( 'thdl_id' => 2, 'otherdate' => 'spmethings22')
);
how can I join / concatenate an array so that it looks like this:
$new_array = array (
0 => array ( 'id' => 1, 'name' => 'somename', 'otherdate' => 'spmethings') ,
1 => array ( 'id' => 2, 'name' => 'somename2', 'otherdate' => 'spmethings22')
);
+2
a source to share