Skip to content

Instantly share code, notes, and snippets.

@FirePanther
Created November 15, 2016 15:46
Show Gist options
  • Save FirePanther/7e25851d2e17b7ad1e48ed821c643ce7 to your computer and use it in GitHub Desktop.
Save FirePanther/7e25851d2e17b7ad1e48ed821c643ce7 to your computer and use it in GitHub Desktop.
<?php
sd('./', parseFile);
/**
* recursive scandir
*/
function sd($d, $cb) {
$s = scandir($d);
foreach ($s as $f) {
if ($f[0] == '.') continue;
elseif (is_dir($d.$f)) sd($d.$f.'/', $cb);
else $cb($d.$f, $f, $d);
}
}
function parseFile($full, $f, $d) {
echo "$full\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment