Return the element key name from the current internal pointer position:
<?php$people=array("Peter","Joe","Glenn","Cleveland");echo "The key from the current position is: " . key($people);?>The key() function returns the element key name from the current internal pointer position.
If there is an error, the function returns FALSE.
key( array )
parameter | describe |
---|---|
array | Required. Specifies the array to use. |
Return value: | Returns the key name of the array element currently pointed to by the internal pointer. |
---|---|
PHP version: | 4+ |