PHp 二维数组合并
2015-12-18 23:56:22 小德 PHP 访问次数 786
mark:$list 和$service_fei二维数组有共同的id,通过id获取$service_fei的制定元素并追加给$list

foreach
($list as $k1 => $v1){
   foreach ($service_fei as $v2) {
       if ($v1['id'] == $v2['user_id']) {
           $list[$k1]['account_service'] = $v2['account_service'];
           $list[$k1]['account_guarantee'] = $v2['account_guarantee'];
       }
   }
}