PHP Doku:: Rewind the file to the first line - splfileobject.rewind.html

Verlauf / Chronik / History: (3) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)DateibehandlungThe SplFileObject classSplFileObject::rewind

Ein Service von Reinhard Neidl - Webprogrammierung.

The SplFileObject class

<<SplFileObject::next

SplFileObject::seek>>

SplFileObject::rewind

(PHP 5 >= 5.1.0)

SplFileObject::rewindRewind the file to the first line

Beschreibung

public void SplFileObject::rewind ( void )

Rewinds the file back to the first line.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Fehler/Exceptions

Throws a RuntimeException if cannot be rewound.

Beispiele

Beispiel #1 SplFileObject::rewind() example

<?php
$file 
= new SplFileObject("misc.txt");

// Loop over whole file
foreach ($file as $line) { }

// Rewind to first line
$file->rewind();

// Output first line
echo $file->current();
?>

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)