tye commented on a Page, Recursive Directory Browser  -  Sep 08, 2005

This is a nice snippet but a a minor change that could improve it a bit. The extension could be treated differently so you can specify no extension and only grab files with no extensions. Would be easy to do like this:

function directoryToArray($directory, $extension = false, $full_path = true) {
if ($extension !== false && strlen($extension)) { $extension = \"\.$extension\"; }

And the if statement that checks for a condition:

if($extension !== false || (ereg(\"$extension\$\", $file)))

Then leaving an empty string would return all files with no extensions, or specifying false (or leaving it empty) will return all files.

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.