PHP 8.6.0 Beta 1 is available for testing

ArrayIterator::current

(PHP 5, PHP 7, PHP 8)

ArrayIterator::currentDevuelve la entrada actual del array

Descripción

public function ArrayIterator::current(): mixed

Obtiene la entrada actual del array .

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

La entrada actual del array .

Ejemplos

Ejemplo #1 Ejemplo de ArrayIterator::current()

<?php
$array = array('1' => 'uno',
 '2' => 'dos',
 '3' => 'tres');
$arrayobject = new ArrayObject($array);
for($iterator = $arrayobject->getIterator();
 $iterator->valid();
 $iterator->next()) {
 echo $iterator->key() . ' => ' . $iterator->current() . "\n";
}
?>

El ejemplo anterior mostrará:

1 => uno
2 => dos
3 => tres

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /