admin 发表于 2023-2-16 18:55:01

PHP中array_fill_keys()使用

<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>给指定的键添加数组</p>
<table><tbody><tr><th>参数</th><th>描述</th></tr><tr><td><em>keys</em></td><td>必需。数组&#xff0c;其值将被用于填充数组的键名。</td></tr><tr><td><em>value</em></td><td>必需。规定用于填充数组的键值。</td></tr></tbody></table>
<blockquote>
<p><?</p>
<p>        $keys&#61;array(&#34;a&#34;,&#34;b&#34;,&#34;c&#34;,&#34;d&#34;);</p>
<p>        $al &#61; array_fill_key($keys,&#34;blue&#34;);</p>
<p>        print_r($a1);</p>
<p>?></p>
</blockquote>
<p></p>
<p> </p>
<p></p>
<p></p>
                </div>
      </div>
      <div id="treeSkill"></div>
页: [1]
查看完整版本: PHP中array_fill_keys()使用