On 12/22/2010 12:16 AM, Platonides wrote:
We are only using opendir for getting a full directory list.
That's a good point. Perhaps what we need is simply a utility method to list all files in a directory.
In fact, I just realized that PHP already has one. It's called scandir(). Its only flaw IMO is that it doesn't automatically skip the current and parent dir entries, but you could always do something like
$files = array_diff( scandir( $dir ), array( '.', '..' ) );
to accomplish that cleanly (or use preg_grep() to remove all dotfiles if you prefer).