wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



array_key_last › WordPress Function

Od5.9.0
Przestarzałyn/a
array_key_last ( $array )
Parametry:
  • (array) $array An array.
    Wymagane: Tak
Powrót:
  • (string|int|null) The last key of array if the array . is not empty; `null` otherwise.
Zdefiniowane na:
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.


Źródło

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

		end( $array );

		return key( $array );
	}
}