downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<ArrayIteratorArrayIterator::key>
Last updated: Thu, 26 Jun 2008

ArrayIterator::current

(PHP 5)

ArrayIterator::current — Return current array entry

Description

mixed ArrayIterator::current ( void )

Get the current array entry.

Parameters

This function has no parameters.

Return Values

The current array entry.

Examples

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

The above example will output:

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



add a noteadd a note User Contributed Notes
Return current array entry
There are no user contributed notes for this page.




<ArrayIteratorArrayIterator::key>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs