Example of using array_merge () to merge similar arrays

巴扎黑
Release: 2016-11-29 09:09:30
Original
1519 people have browsed it

Merge arrays of the same type, simple example of array_merge () function

$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;  
    }  
}
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!