Unix implementation of DirectoryIterator (on my Linux) returns files and directories in pretty strange order. This is because readdir() function doesn't guarantee any order. Windows implementation of DirectoryIterator returns files and directories in simple alphabetical order (though it isn't guaranteed too). I can't be sure but VMS implementation may have the same feature.
Class users also may be interested in getting directories before files like most file browsers shows.
Maybe it's reasonable to create some class like SortedDirectoryIterator which will output the content in some kind of convetional way. I've created one and offer a patch which is attached.