Returns the key for the current element.
This function is similar to current(), but returns the key for the current element instead of the element itself.
<?php
$array1 = array(
"un" => "one",
"deux" => "two",
"trois" => "three");
while ($key = key($array1)) {
print "$key ";
next($array1);
}
?>
un deux trois
The array in the example contains translations from French to English. All the French words are printed.