php8.5
Home/ Manual/ predefined / iterator/ Iterator::key

Iterator::key

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Return the key of the current element

Description

Iterator::key(): mixed

Returns the key of the current element.

Parameters Parameters

Return Values

Returns scalar on success, or null on failure.

Errors/Exceptions

Issues E_NOTICE on failure.

Source: language/predefined/iterator/key.xml · from the official PHP manual (php/doc-en)