Last active
December 22, 2015 08:39
-
-
Save Darfk/6446846 to your computer and use it in GitHub Desktop.
Returns a flat array of all the files in $d relative to $d.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Returns a flat array of all the files in $d | |
function scandir_recursive ( $d, $b = '' ) | |
{ | |
$ls = scandir ( $d ); | |
$a = array(); | |
foreach ( $ls as $v ) | |
{ | |
if ( $v == '.' || $v == '..' ) continue; | |
if ( is_dir ( $d . '/' . $v ) ) | |
{ | |
$a = array_merge ( scandir_recursive ( $d . '/' . $v, $v ), $a ); | |
} | |
else | |
{ | |
$a []= $b . '/' . $v; | |
} | |
} | |
return $a; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment