Reputation: 311
The following code catches all files recursively in the php extension.
$paths = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($realPath), \RecursiveIteratorIterator::SELF_FIRST);
$files = new \RegexIterator($paths, '/\.(?:php)$/', \RegexIterator::MATCH);
foreach($files as $file){
...
I want to get files from any extension.
I want something to replace it: '/\.(?:php)$/'
Upvotes: 0
Views: 52