PHP 8.5.0 RC 2 available for testing

ArrayIterator::current

(PHP 5, PHP 7, PHP 8)

ArrayIterator::current β€” Devuelve la entrada actual del array

DescripciΓ³n

public 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

οΌ‹add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top