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:
- ? /* First Build First array */
- $ Fruitarray = Array ("Apple", "orange", "banana", "Peach", "pear");
- /* Next Create a second array */
- $ Vegarray = Array ("Carrot", "green beans", "asparagus", "artichoke", "corn");
- /* Now use the Array_merge () function to merge two arrays into a new array */
- $ Goodfoodarray = Array_merge ($fruitArray, $vegArray);
- /* Finally, we display the key (key) and the value of all elements of the merged new array on the Web page */
- while (list ($key, $value) = each ($goodfoodArray)) {
- echo "$key: $value
";
- }
- ? >
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 ...