note 59249 added to function.opendir
| From: | neale-php at woozle dot org | Date: | Wed, 30 Nov 2005 17:41:45 +0000 |
| Subject: | note 59249 added to function.opendir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99370@lists.php.net to get a copy of this message | ||
oryan's example is still sub-optimal, even if people using it never ever substitute a variable
for directory.
Just use PHP's glob() function, which will be faster and more efficient anyway since it
doesn't have to launch a shell and run the ls program (that's what the shell_exec does).
$result = glob("directory/*");
----
Manual Page -- http://www.php.net/manual/en/function.opendir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59249
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59249&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59249&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59249&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59249&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59249&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59249&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59249&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59249&report=yes
Search -- http://master.php.net/manage/user-notes.php