Skip to content

Instantly share code, notes, and snippets.

View jfcherng's full-sized avatar
🦀
Yes, that should work.

Jack Cherng jfcherng

🦀
Yes, that should work.
View GitHub Profile
@jfcherng
jfcherng / recursive_glob.php
Last active August 29, 2015 14:25
Recursive glob() for PHP 5.
function recuresive_glob ($dir, $regex) {
$dirIt = new RecursiveDirectoryIterator($dir);
$itIt = new RecursiveIteratorIterator($dirIt);
$files = new RegexIterator($itIt, $regex, RegexIterator::GET_MATCH);
$fileList = array();
foreach ($files as $file) {
$fileList[] = $file[0];
}
return $fileList;
}