PHP 8.6.0 Beta 1 is available for testing

Iterator::rewind

(PHP 5, PHP 7, PHP 8)

Iterator::rewindRebobine la Iterator al primer elemento

Descripción

public function Iterator::rewind(): void

Rebobina de nuevo al primer elemento de la Iterator.

Nota:

Este es el primer método llamado cuando se inicia un foreach bucle. No va a ser ejecutado despues foreach bucle.

Como foreach siempre llama a rewind() antes de iniciar la iteración, avanzar manualmente la posición del iterador (por ejemplo mediante SplFileObject::seek() ) será reiniciado. Para iterar sin rebobinar el iterador, envuélvalo en un NoRewindIterator .

Parámetros

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

Valores devueltos

Cualquier valor devuelto se pasa por alto.

Found A Problem?

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

User Contributed Notes 1 note

up
18
al
10 years ago
Builtin PHP function is »reset«.
Don't mix this with builtin function »rewind« which operates on file handle.
+add a note

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