PHP code example of thapp / fileitr

1. Go to this page and download the library: Download thapp/fileitr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thapp / fileitr example snippets



use Thapp\Fileitr\PatternIterator;

// iterates over a maximum directory depth of 2, searching for files with a '.php' suffix
$itr = new PatternIterator($path, '/\.(php)$/', 2, -1, $flags);

// iterates over a maximum directory depth of 1, and limits overall files to 3.
$itr = new PatternIterator($path, '/\.(php)$/', 1, 3, $flags);
bash
php >= 5.6