Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 15 lines (14 sloc) 0.54 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php
/**
* The below example is the simplest case of iterating over all direct children of a directory,
* without recursing into sub-directories. The "." and ".." references are skipped.
*/

// iterate over all files from the child directory "directory-iterator-example"
$files = new DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'directory-iterator-example');
foreach ($files as $file) {
    // skip over dots ("." and "..")
    if (!$file->isDot()) {
        // example of the
        echo $file->getRealPath() . PHP_EOL;
    }
}
Something went wrong with that request. Please try again.