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

PHP中 array_key_last()函数

<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">
                  <blockquote>
<p><?php</p>
<p>$array &#61; ['a'&#61;>1,'b'&#61;>2,'c'&#61;>3];</p>
<p>$lastKey &#61; array_key_last($array);</p>
<p>echo $lastKey;</p>
<p>?></p>
</blockquote>
<h2>定义和用法</h2>
<p>使用array_key_last($array);能取出数组中最后一个键值&#xff0c;输出结果为c。</p>
<p>取得指定数组的 array 最后一个键值&#xff0c;不会影响到原数组的内部指针。</p>
<hr>
<h2>语法</h2>
<pre>array_key_last ( array $array ) : mixed
</pre>
<table><tbody><tr><th>参数</th><th>描述</th></tr><tr><td style="vertical-align:top;"><em>array</em></td><td style="vertical-align:top;">要操作的数组。</td></tr></tbody></table>
<p></p>
<p> </p>
<p></p>
<p></p>
<p></p>
<p></p>
                </div>
      </div>
      <div id="treeSkill"></div>
页: [1]
查看完整版本: PHP中 array_key_last()函数