note 102660 added to function.glob
| From: | White-Gandalf at web dot de | Date: | Sun, 27 Feb 2011 15:25:09 +0000 |
| Subject: | note 102660 added to function.glob | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177368@lists.php.net to get a copy of this message | ||
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);
----
Server IP: 217.160.235.204
Probable Submitter: 94.223.142.182
----
Manual Page -- http://www.php.net/manual/en/function.glob.php
Edit -- https://master.php.net/note/edit/102660
Del: integrated -- https://master.php.net/note/delete/102660/integrated
Del: useless -- https://master.php.net/note/delete/102660/useless
Del: bad code -- https://master.php.net/note/delete/102660/bad+code
Del: spam -- https://master.php.net/note/delete/102660/spam
Del: non-english -- https://master.php.net/note/delete/102660/non-english
Del: in docs -- https://master.php.net/note/delete/102660/in+docs
Del: other reasons-- https://master.php.net/note/delete/102660
Reject -- https://master.php.net/note/reject/102660
Search -- https://master.php.net/manage/user-notes.php