joining / merging two arrays

Posted by Shishant on Stack Overflow See other posts from Stack Overflow or by Shishant
Published on 2010-04-28T21:02:34Z Indexed on 2010/04/28 21:07 UTC
Read the original article Hit count: 311

Filed under:
|

I have two arrays like this, actually this is mysql data retrieved 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 / merge array so it looks like this

$new_array = array ( 
         0 => array ( 'id' => 1, 'name' => 'somename', 'otherdate' => 'spmethings') ,
         1 => array ( 'id' => 2, 'name' => 'somename2', 'otherdate' => 'spmethings22') 
);

© Stack Overflow or respective owner

Related posts about php

Related posts about collections