admin 发表于 2023-2-16 18:54:59

PHP中的array_merge_recursive()函数

<div id="article_content" class="article_content clearfix">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-6e43165c0a.css">
                <div id="content_views" class="htmledit_views">
                  <h2>定义和用法</h2>
<p>array_merge_recursive() 函数用于把一个或多个数组合并为一个数组。</p>
<p>该函数与 <ahref="https://www.runoob.com/php/func-array-merge.html">array_merge()</a> 函数之间的不同是在处理两个或更多个数组元素有相同的键名的情况。array_merge_recursive() 不会进行键名覆盖&#xff0c;而是将多个相同键名的值递归组成一个数组。</p>
<p><strong>注释&#xff1a;</strong>如果您仅仅向 array_merge_recursive() 函数输入一个数组&#xff0c;结果与 <ahref="https://www.runoob.com/php/func-array-merge.html">array_merge()</a> 相同&#xff0c;函数将返回带有整数键名的新数组&#xff0c;其键名以 0 开始进行重新索引。</p>
<hr>
<h2>语法</h2>
<p>array_merge_recursive(<em>array1,array2,array3...</em>)</p>
<p></p>
<table><tbody><tr><th>参数</th><th>描述</th></tr><tr><td style="vertical-align:top;"><em>array1</em></td><td style="vertical-align:top;">必需。规定数组。</td></tr><tr><td style="vertical-align:top;"><em>array2</em></td><td style="vertical-align:top;">可选。规定数组。</td></tr><tr><td style="vertical-align:top;"><em>array3</em></td><td style="vertical-align:top;">可选。规定数组。</td></tr></tbody></table>
<p></p>
<p> </p>
<p></p>
<p></p>
                </div>
      </div>
      <div id="treeSkill"></div>
页: [1]
查看完整版本: PHP中的array_merge_recursive()函数