Folder::getIterator()

The external iterator receiver.

Table of Contents
  1. Description
  2. Example

Description

Folder::getIterator(): Traversable;

This method is a requirement to be able to implement the IteratorAggregate interface and aims to make the object iterable directly. You won’t use this method directly, iteration control structures such as for, foreach and while will call this method automatically. For this class, this method will be passed to Folder::stream().

Example

$folder = new Folder('.\path\to\folder');

// Using `foreach` loop
foreach ($folder as $k => $v) {
    echo $k . '<br>';
}

Folder::getIterator()

The external iterator receiver.

Folder::size()

Gets the total sizes of files contained in the folder in human readable string format.