We may be on the PHP function array_merge () may not be very understanding.But it's presented by this PHP function array_merge () the array of combined function, the function we will certainly have some degree of understanding.It can merge two or more arrays into a new array, the array element in the merger when the merger is based on the original array in order to be called to decide the order.
If the original array itself has been re-sorted, then the merger is completed in an array, you have generated a new array for re-ordering again.The following example on the introduction of PHP function array_merge () of use:
/ Bin / boot / dev / etc / home / lib / lost + found / media / misc / mnt / net / opt / proc / root / sbin / selinux / srv / sys / tmp / u01 / usr / var / vmwareFirst, create the first array of backup / bin / conf / data / log / maint / svn / tmp / $ fruitArray = array ("apple", "orange", "banana", "Peach", "pear"); / bin / boot / dev / etc / home / lib / lost + found / media / misc / mnt / net / opt / proc / root / sbin / selinux / srv / sys / tmp / u01 / usr / var / vmwareThen create a second array of backup / bin / conf / data / log / maint / svn / tmp / $ vegArray = array ("carrot", "green beans", "asparagus", "artichoke", "; corn "); / bin / boot / dev / etc / home / lib / lost + found / media / misc / mnt / net / opt / proc / root / sbin / selinux / srv / sys / tmp / u01 / usr /var / vmware now use array_merge () function to merge two arrays into a new array of backup / bin / conf / data / log / maint / svn / tmp / $ goodfoodArray = array_merge ($ fruitArray, $ vegArray); / bin /boot / dev / etc / home / lib / lost + found / media / misc / mnt / net / opt / proc / root / sbin / selinux / srv / sys / tmp / u01 / usr / var / vmware Finally we combinedall the elements of the new array of keys (key) and value (value) are displayed on the website backup / bin / conf / data / log / maint / svn / tmp / while (list ($ key, $ value) = each ($ goodfoodArray)) {echo "$ key: $ value
";}?>
Showing results are as follows:
0: apple
1: orange
2: banana
3: Peach
4: pear
5: carrot
6: green beans
7: asparagus
8: artichoke
9: corn
PHP function array_merge () in the array to use the combination as shown above.