note 77479 deleted from function.scandir by cmb
| From: | cmb@php.net | Date: | Sun, 17 Nov 2019 09:06:04 +0000 |
| Subject: | note 77479 deleted from function.scandir by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213121@lists.php.net to get a copy of this message | ||
Note Submitter: deryckchan at gmail dot com
----
Bear in mind that sorting is *always* performed when scandir() is called. String sorting takes
O(|s|n log n) runtime, and this adds to the burden of the server's memory and processing power.
Therefore, whenever the alphabetical order of the directory content is unimportant, especially if
sorting is to be performed by another order, or the natural order of the files on the filesystem is
to be utilized, the use of opendir(), readdir() and closedir() combined is always preferred to
scandir().