ArrayIterator::current

(PHP 5, PHP 7)

ArrayIterator::currentReturn current array entry

说锟斤拷

public ArrayIterator::current ( void ) : mixed

Get the current array entry.

锟斤拷锟斤拷

锟剿猴拷锟斤拷没锟叫诧拷锟斤拷锟斤拷

锟斤拷锟斤拷值

The current array entry.

锟斤拷锟斤拷

Example #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";
}
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

1 => one
2 => two
3 => three