Is there a simple way to sort an iterator in PHP (without just pulling it all into an array and sorting that).
The specific example I have is a DirectoryIterator but it would be nice to have a solution general to any iterator.
$dir = new DirectoryIterator('.');
foreach ($dir as $file)
echo $file->getFilename();
I'd like to be able to sort these by various criteria (filename, size, etc)