@Chiang
2020-01-16T18:16:26.000000Z
字数 443
阅读 605
PHP-Array
array_key_last — Gets the last key of an array
array_key_last ( array $array ) : mixed
Get the last key of the given array without affecting the internal array pointer.
- array
An array.
Returns the last key of array if the array is not empty; NULL otherwise.
For PHP <= 7.3.0 :
if (! function_exists("array_key_last")) {
function array_key_last($array) {
if (!is_array($array) || empty($array)) {
return NULL;
}
return array_keys($array)[count($array)-1];
}
}