In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how to define the use of array_merge, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
Array_merge () is a function in the PHP language that combines the cells of two or more arrays, the value of the same string key overrides the previous value, and the values corresponding to the numeric index are reordered and the results are returned.
Array_merge () definition
Array_merge () merges the cells of one or more arrays, with values in one array appended to the previous array. Returns an array as a result.
Arrayarray_merge (array$array1 [, array$array2 [, array$...]])
Usage of array_merge ()
1) if the input array has the same string key name, the key value of the key is the value corresponding to the last key name (the latter value overrides the previous same value). If the array is a numeric key name, the key name will be re-indexed in a continuous manner, that is, the subsequent value will not overwrite the original value, but will be appended to it.
2) if only an array is entered into the array_merge () function, and the key name is an integer, the function returns a new array with the integer key name, whose key name starts with 0 for re-indexing. (see example 2)
3): when the key name of the following array element is the same as that of the previous array element, the key value of the corresponding key name in the resulting array is overwritten by the latter, that is, the latter key value. (see example 3)
Grammar.
Array_merge (array1 [, array2 [, array3...]])
Parameters.
Description
Array1
Necessary. The first array entered.
Array2
Optional. The second array entered.
Array3
Optional. Multiple input arrays that can be specified.
Example 1
Output:
Array ([a] = > Horse [b] = > Cat [c] = > Cow)
Example 2
Use only one array parameter:
Output:
Array ([0] = > Horse [1] = > Dog)
Example 3
Output:
Array ([a] = > Cow [b] = > Cat)
The above is all the content of the article "how array_merge defines its use". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.