09-10-2012, 06:31 AM
|
#6 (permalink)
|
|
The Visitor
Join Date: Sep 2012
Posts: 2
Thanks: 0
|
Your code skips all files
Quote:
Originally Posted by ETbyrne
OK, here's a sweet little function I made that does exactly what you need:
PHP Code:
function glob_recursive($dir) { static $g = array(); foreach(glob($dir,GLOB_ONLYDIR) as $i=>$k) { $g[] = $k; glob_recursive($k.'/*'); } return $g; }
And use like so:
PHP Code:
print_r(glob_recursive('dingo/*'));
The only problem is, you can't use it twice. I'll let you figure out how to fix that though. 
|
Your code skips all files and will return an empty array if there's no any subfolders.
|
|
|
|