The DirectoryIterator class

(PHP 5, PHP 7, PHP 8)

Introduction

The DirectoryIterator class provides a simple interface for viewing the contents of filesystem directories.

Class synopsis

class DirectoryIterator extends SplFileInfo implements SeekableIterator {
/* Methods */
public __construct(string $directory)
public current(): mixed
public getBasename(string $suffix = ""): string
public isDot(): bool
public key(): mixed
public next(): void
public rewind(): void
public seek(int $offset): void
public __toString(): string
public valid(): bool
/* Inherited methods */
public SplFileInfo::getBasename(string $suffix = ""): string
public SplFileInfo::openFile(string $mode = "r", bool $useIncludePath = false, ?resource $context = null): SplFileObject
public SplFileInfo::setFileClass(string $class = SplFileObject::class): void
public SplFileInfo::setInfoClass(string $class = SplFileInfo::class): void
}

Table of Contents