Heim  >  Artikel  >  Backend-Entwicklung  >  php函数array_merge ()用法一例(合并同类数组)

php函数array_merge ()用法一例(合并同类数组)

WBOY
WBOYOriginal
2016-07-25 09:05:281232Durchsuche
  1. $arr1 = $dblink->mem_fetch_array ( "SELECT t_pid,imgname,invented,score FROM `t_sum_giftimg` where t_pid=3 or t_pid=6", 0 );
  2. $arr2 = $dblink->mem_fetch_array ( "SELECT t_pid,imgname,invented,score FROM `t_sum_giftimg` where t_pid=10 or t_pid=12", 0 );
  3. $imgInfo = array_merge ( $arr1, $arr2 );
  4. if ($imgInfo) {
  5. foreach ( $imgInfo as $imgInfo ) {
  6. $imgs [] = $imgInfo;
  7. }
  8. }
复制代码

您可能感兴趣的文章: php创建数组的方法介绍 php使用array_unique判断数组中是否存在相同的值 php数组函数 in_array() 查找数组中是否存在指定值 php数组函数array_key_exists() 查找数组键名是否存在 php数组去重的小例子 有关php数组及循环的小例子 加强版的array_unique函数(支持二维数组) php数组回调过滤函数array_filter()的应用实例 php从数组中提取变量的函数及应用实例 从数组中随机抽取一些元素的php代码 使用php数组为文章内容自动加链接的代码 php增加与删除数组元素的方法



Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn