FilesystemIterator::next

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

FilesystemIterator::nextMove to the next file

Beschreibung

public function FilesystemIterator::next(): void

Move to the next file.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #1 FilesystemIterator::next() example

List the contents of a directory using a while loop.

<?php
$iterator = new FilesystemIterator(dirname(__FILE__));
while($iterator->valid()) {
    echo $iterator->getFilename() . "\n";
    $iterator->next();
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

apple.jpg
banana.jpg
example.php

Siehe auch