PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<splArrayIterator::key>
Last updated: Mon, 16 Jul 2012

ArrayIterator::current

(no version information, might be only in CVS)

ArrayIterator::current --  Return current array entry

Description

mixed ArrayIterator::current ( void )

This function returns the current array entry

例子 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




<splArrayIterator::key>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST