How to combine multiple arrays into an array in PHP

Source: Internet
Author: User
Tags arrays exit join

The Array_merge () function merges two or more arrays into an array.

If the key name is duplicated, the key value of the key is the value of the last key name (preceded by the overlay). If the array is a numeric index, the key name is sequentially indexed.

For example:

$news =m (' News ');     
  $sql = "SELECT count (a.news_id) as Count_news,a.menu_id,b.pid from News a left join menu B on a.menu_id=b.menu_id where a.is _pass=0 GROUP by a.menu_id; ";  
  $count = $news->query ($sql);  
  $text _check=m (' Text_check ');  
  $sql 2= "SELECT count (a.check_id) as Count_news,a.menu_id,b.pid from Text_check a left join menu B on a.menu_id=b.menu_id wh Ere a.is_pass=0 GROUP by a.menu_id; ";  
  $count 2= $text _check->query ($sql 2);  
Dump ($count); exit
Dump ($count 2); exit;  
Dump (Array_merge ($count, $count 2)); exit;

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/PHP/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.