CakeFest 2024: The Official CakePHP Conference

ArrayIterator::rewind

(PHP 5, PHP 7, PHP 8)

ArrayIterator::rewindRebobinar array al inicio

Descripción

public ArrayIterator::rewind(): void

Rebobina el iterador al inicio del array.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

No devuelve ningún valor.

Ejemplos

Ejemplo #1 Ejemplo de ArrayIterator::rewind()

<?php
$arrayobject
= new ArrayObject();

$arrayobject[] = 'zero';
$arrayobject[] = 'one';
$arrayobject[] = 'two';

$iterator = $arrayobject->getIterator();

$iterator->next();
echo
$iterator->key(); //1

$iterator->rewind(); //rebobinar al inicio
echo $iterator->key(); //0
?>

add a note

User Contributed Notes

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