wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



array_key_last › WordPress Function

Da5.9.0
Deprecaton/a
array_key_last ( $array )
Parametri:
  • (array) $array An array.
    Richiesto:
Ritorna:
  • (string|int|null) The last key of array if the array . is not empty; `null` otherwise.
Definito a:
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.


Sorgenti

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

		end( $array );

		return key( $array );
	}
}