wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



array_key_last › WordPress Function

Desde5.9.0
Obsoleton/a
array_key_last ( $array )
Parâmetros:
  • (array) $array An array.
    Required: Yes
Retorna:
  • (string|int|null) The last key of array if the array . is not empty; `null` otherwise.
Definido em:
Codex:

Polyfill for `array_key_last()` function added in PHP 7.3.

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


Fonte

function array_key_last( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
		if ( empty( $array ) ) {
			return null;
		}

		end( $array );

		return key( $array );
	}
}