Php function array_merge () usage example (merging similar arrays)

Source: Internet
Author: User
Php function array_merge () usage example (merging similar arrays)

  1. $ Arr1 = $ dblink-> mem_fetch_array ("SELECT t_pid, imgname, sorted Ted, score FROM 't_ sum_giftimg 'where t_pid = 3 or t_pid = 6", 0 );
  2. $ Arr2 = $ dblink-> mem_fetch_array ("SELECT t_pid, imgname, sorted Ted, 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. }

Articles that you may be interested in: Introduction to the php method for creating arrays. php uses array_unique to determine whether the same value exists in the array. php array function in_array () queries whether the specified value of the php array function array_key_exists () exists in the array () small example of checking whether the array key name contains php array deduplication small example of php array and loop small example enhanced version of the array_unique function (supports two-dimensional array) php array callback filter function array_filter () application instance php extract variable functions from the array and application instances randomly extract some elements from the array php code use php array to automatically add links to the article content php add and delete arrays element method

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.