PHP code example of wgirhad / filename-iterator
1. Go to this page and download the library: Download wgirhad/filename-iterator 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/ */
wgirhad / filename-iterator example snippets
use Wgirhad\FilenameIterator\Iterator as FilenameIterator;
foreach (new FilenameIterator('public/static', '*.png') as $filename) {
echo "{$filename}\n";
}
// outputs:
// public/static/foo.png
// public/static/images/bar.png
// public/static/images/baz.png
// public/static/images/.peek/aboo.png
use Wgirhad\FilenameIterator\Iterator as FilenameIterator;
foreach (new FilenameIterator('*', '*Coolest*.php') as $filename) {
echo "{$filename}\n";
}
// outputs:
// src/CoolestClass.php
// src/SecondCoolest.php
// tests/CoolestClassTest.php
// tests/SecondCoolestTest.php