$a1=array( array('username' => '天天','enjoyname1' => '百度','enjoyurl1' => 'HTTP://baidu.com'), array('username' => '霖霖', 'enjoyname1' =>'搜狐','enjoyurl1' =>'HTTP://sohu.com'));
$a2=array( array('username' => '天天','enjoyname2' => '新浪','enjoyurl2' => ' HTTP://sina.com'), array('username' => '霖霖', 'enjoyname2' =>'腾讯','enjoyurl2' =>'HTTP://qq.com'));
$r1 = array();
$r2 = array();
foreach ($a1 as $key => $value) {
$r1[$value['username']] = $value;
}
foreach ($a2 as $key => $value) {
$r2[$value['username']] = $value;
}
$result = array_merge_recursive($r1, $r2);
foreach ($result as $key => $value) {
$result[$key]['username'] = $value['username'][0];
}
print_r($result);