Asperon
27 Mar 2012, 07:22 PM
Which do you guys prefer? Glob or the DirectoryIterator?
Here is an article describing a recursive function for each: http://thephpeffect.com/recursive-glob-vs-recursive-directory-iterator/
I feel that rglob() would be slower than the rsearch() function described in the article if it didn't need to use array_merge() to combine all of the results. But unfortunately the results come back as a two dimensional array but really it is just an array as a single element of a parent array. Since there is never more than array per parent, why shouldn't it just return the original?
Therefore I think rglob() is faster. If anyone wants to benchmark it that would be awesome. I don't have the time right now, but I am curious.
Here is an article describing a recursive function for each: http://thephpeffect.com/recursive-glob-vs-recursive-directory-iterator/
I feel that rglob() would be slower than the rsearch() function described in the article if it didn't need to use array_merge() to combine all of the results. But unfortunately the results come back as a two dimensional array but really it is just an array as a single element of a parent array. Since there is never more than array per parent, why shouldn't it just return the original?
Therefore I think rglob() is faster. If anyone wants to benchmark it that would be awesome. I don't have the time right now, but I am curious.