PHP Dokumentation: Arrayiterator current
12. Januar 2010 von werner
ArrayIterator::current
(PHP 5 >= 5.0.0)
ArrayIterator::current — Return current array entry
Parameter-Liste
Diese Funktion hat keine Parameter.
Rückgabewerte
The current array entry.
Beispiele
Beispiel #1 ArrayIterator::current() example
<?php
$array = array('1' => 'one',
'2' => 'two',
'3' => 'three');$arrayobject = new ArrayObject($array);for(
$iterator = $arrayobject->getIterator();
$iterator->valid();
$iterator->next()) { echo
$iterator->key() . ' => ' . $iterator->current() . "\n";
}
?>Das oben gezeigte Beispiel erzeugt folgendeAusgabe:
1 => one2 => two3 => three