当前位置:Gxlcms > PHP教程 > array_merge()使用举例,合并同类数组

array_merge()使用举例,合并同类数组

时间:2021-07-01 10:21:17 帮助过:20人阅读

合并同类型数组,array_merge ()函数简单举例

$arr1 = $dblink->mem_fetch_array ( "SELECT t_pid,imgname,invented,score FROM `t_sum_giftimg` where t_pid=3 or t_pid=6", 0 );  
$arr2 = $dblink->mem_fetch_array ( "SELECT t_pid,imgname,invented,score FROM `t_sum_giftimg` where t_pid=10 or t_pid=12", 0 );  
$imgInfo = array_merge ( $arr1, $arr2 );  
if ($imgInfo) {  
    foreach ( $imgInfo as $imgInfo ) {  
        $imgs [] = $imgInfo;  
    }  
}

人气教程排行