<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Gets the last key of an array</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.array-key-first.html">array_key_first</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.array-keys.html">array_keys</a></div> <div class="up"><a href="ref.array.html">Array Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.array-key-last" class="refentry"> <div class="refnamediv"> <h1 class="refname">array_key_last</h1> <p class="verinfo">(PHP 7 >= 7.3.0)</p><p class="refpurpose"><span class="refname">array_key_last</span> — <span class="dc-title">Gets the last key of an array</span></p> </div> <div class="refsect1 description" id="refsect1-function.array-key-last-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>array_key_last</strong></span> ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$array</code></span> )</div> <p class="para rdfs-comment"> Get the last key of the given <code class="parameter">array</code> without affecting the internal array pointer. </p> </div> <div class="refsect1 parameters" id="refsect1-function.array-key-last-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">array</code></dt> <dd> <p class="para"> An array. </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.array-key-last-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the last key of <code class="parameter">array</code> if the array is not empty; <strong><code>NULL</code></strong> otherwise. </p> </div> <div class="refsect1 seealso" id="refsect1-function.array-key-last-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"><span class="function"><a href="function.array-key-first.html" class="function" rel="rdfs-seeAlso">array_key_first()</a> - Gets the first key of an array</span></li> <li class="member"><span class="function"><a href="function.end.html" class="function" rel="rdfs-seeAlso">end()</a> - Set the internal pointer of an array to its last element</span></li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.array-key-first.html">array_key_first</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.array-keys.html">array_keys</a></div> <div class="up"><a href="ref.array.html">Array Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>