10 articles about phparray_merge () functions are recommended.

Source: Internet
Author: User
1 $ arr1array (1, 2, 3, 4, & amp; #39; color & amp; #39; & amp; gt; & amp; #39; red & amp; #39;); 2 $ arr2array (& amp; #39; a & amp; #39;, & amp; #39; B & amp; #39;, & amp; #39; c & amp; #39;, & amp; #39; color & amp; #39; & amp; gt; & amp; #39; blue & amp; #39;); 3print_r (array_merge ($ arr1, $ ar 1 $ arr1 = array (1, 2, 3, 4, 'color' => 'red '); 2 $ arr2 = array ('A', 'B', 'C', 'color' => 'blue'); 3 print_r (array_merge ($ arr1, $ arr2); // The value of the index with the same name will overwrite 4 print_r (array_merge_recursi Ve ($ arr1, $ arr2); // the same key name will not be overwritten. if a single element is converted into a one-dimensional array, both functions are used to merge arrays. The parameter can be 1 to n arrays. (Er, I don't know what to use when the parameter is an array. Who knows to tell me .) Output result: row 3rd: Array ([0] => 1 &

1. Detailed introduction to the array_merge_recursive function

Introduction: The array_merge () function combines arrays and returns a Union array. The obtained array starts with the first input array parameter and is immediately added according to the order in which the following array parameters appear. The format is: 1 array array_merge (array array1 array2 ..., ArrayN) combines the units of one or more arrays. the values of an array are appended to the previous array. Returns an array of results. If the input array contains the same string key name, the key name is followed...

10. common array functions in php (7) array merging array_merge () and array_merge_recursive ()

Introduction: common array functions in php (7) array merging array_merge () and array_merge_recursive ()

[Related Q & A recommendations ]:

In laravel-php, how does one splice this data type in a function?

Php-question about adding a function to array_merge in a loop

Php foreach array_merge problems and confusions

Suspect: A bug in php array_merge_recursive

Thinkphp-php array merge

The above is the article about php array_merge () function. we recommend 10 articles in detail. For more information, see other related articles in the first PHP community!

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.