php function Array_merge () Merge array specific method parsing _php tutorial

Source: Internet
Author: User
We may be rightIf the original array itself has already been reordered, then after the array merge is complete, you must reorder the new array that was created. The following example shows how PHP functions Array_merge () are used:
 
 
  1. ? /* First Build First array */
  2. $ Fruitarray = Array ("Apple", "orange", "banana", "Peach", "pear");
  3. /* Next Create a second array */
  4. $ Vegarray = Array ("Carrot", "green beans", "asparagus", "artichoke", "corn");
  5. /* Now use the Array_merge () function to merge two arrays into a new array */
  6. $ Goodfoodarray = Array_merge ($fruitArray, $vegArray);
  7. /* Finally, we display the key (key) and the value of all elements of the merged new array on the Web page */
  8. while (list ($key, $value) = each ($goodfoodArray)) {
  9. echo "$key: $value
    ";
  10. }
  11. ? >

The results appear as follows:

0:apple

1:orange

2:banana

3:peach

4:pear

5:carrot

6:green Beans

7:asparagus

8:artichoke

9:corn

The PHP function Array_merge () is used in the array merge as shown above.


http://www.bkjia.com/PHPjc/446379.html www.bkjia.com true http://www.bkjia.com/PHPjc/446379.html techarticle we might be right. If the original array itself has already been reordered, then after the array merge is complete, you must reorder the new array that was created. The following example ...

  • Related Article

    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.