Skip to content

Instantly share code, notes, and snippets.

@sistematico
Created September 8, 2020 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sistematico/d9d78582ee2f86b7c477e372bafdcbff to your computer and use it in GitHub Desktop.
Save sistematico/d9d78582ee2f86b7c477e372bafdcbff to your computer and use it in GitHub Desktop.
PHP Directory Iterator
<?php
// https://stackoverflow.com/a/25909955/1844007
// Construct the iterator
$it = new RecursiveDirectoryIterator("/components");
// Loop through files
foreach(new RecursiveIteratorIterator($it) as $file) {
if ($file->getExtension() == 'html') {
echo $file;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment