Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<array_key_firstarray_keys>
^Array FunctionsLast updated: Mon, 26 Oct 2026

array_key_last

(PHP 7 >= 7.3.0, PHP 8)

array_key_last — Gets the last key of an array

Description

function array_key_last(array $array): int|string|null

Get the last key of the given array without affecting the internal array pointer.

Parameters

array

An array.

Return Values

Returns the last key of array if the array is not empty; null otherwise.

See Also


<array_key_firstarray_keys>
^Array FunctionsLast updated: Mon, 26 Oct 2026