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?
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.
Update: it looks good to use DirectoryIterator(), but how do you sort the items?