ArrayIterator::key

(PHP 5 >= 5.0.0, PHP 7)
Return current array key
public mixed ArrayIterator::key ( void )

This function returns the current array key

Returns:

The current array key.

Examples:
ArrayIterator::key() example
<?php
$array = array('key' => 'value');

$arrayobject = new ArrayObject($array);
$iterator = $arrayobject->getIterator();

echo $iterator->key(); //key
?>

doc_php
2016-02-24 16:19:39
Comments
Leave a Comment

Please login to continue.