note 102660 deleted from function.glob by danbrown
| From: | danbrown@php.net | Date: | Sun, 27 Feb 2011 16:19:00 +0000 |
| Subject: | note 102660 deleted from function.glob by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177370@lists.php.net to get a copy of this message | ||
Note Submitter: White-Gandalf at web dot de
----
Regarding the so called "fastest way":
"glob" is up to ten (!) times slower than any other internal php function! If you are
really interested in FAST directory walking, use "scandir" instead!
Try it for yourself!
$t0 = microtime(true);
$files = glob($path.'/*');
$t1 = microtime(true);
echo "glob('".$path."/*') : ".($t1 - $t0)."\r\n";
print_r($files);
$t0 = microtime(true);
$files = scandir($path);
$t1 = microtime(true);
echo "scandir('".$path."'): ".($t1 - $t0)."\r\n";
print_r($files);