php - Easiest way to do this array merge -


i have 2 db queries return values db, what's easiest way this. there php function can or have use loop ?

$names = array(         'det-1' => array('foo'),         'det-2' => array('bar'),         'det-3' => array('doe')     );            $emails = array(         'det-1' => array('foo@gmail.com'),         'det-2' => array('bar@gmail.com'),         'det-3' => array('doe@gmail.com')     ); 

// result

    $details = array(         'det-1' => array('foo', 'foo@gmail.com')         'det-2' => array('bar', 'bar@gmail.com')         'det-3' => array('doe', 'doe@gmail.com')     ); 

you can use array_merge_recursive

$newarray = array_merge_recursive($names, $emails); 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -