If not using exec("ls -l") in PHP, do we need to call stat() to get the file sizes 1000 times if there are 1000 files?
<p>If we don't use exec("ls -l") in PHP, but use readdir() or scandir() to get the list of files, and want to list the file sizes and maybe modification date as well, do we need to call stat() 1000 times if there are 1000 files?  Is there a simpler or faster way?</p>

<p>Will calling stat() 1000 times hit the file system a lot?  Or maybe the OS will cache all the data in memory so it involves only access to RAM but not to the disk.</p>

<p><strong>Update:</strong> it looks good to use DirectoryIterator(), but how do you sort the items?</p>
