note 76317 added to function.scandir
| From: | AndersdotJenboatPcdotDK at osu1 dot php dot net | Date: | Tue, 10 Jul 2007 10:59:08 +0000 |
| Subject: | note 76317 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128362@lists.php.net to get a copy of this message | ||
greg at sasses dot net posted a function for php versions befor 5, but it still contained a few
mistakes so here is a more accurate version.
if(!function_exists('scandir')) {
function scandir($dir, $sortorder = 0) {
if(is_dir($dir) && $dirlist = @opendir($dir)) {
while(($file = readdir($dirlist)) !== false) {
$files[] = $file;
}
closedir($dirlist);
($sortorder == 0) ? asort($files) : rsort($files); // arsort was replaced with rsort
return $files;
} else return false;
}
}
----
Server IP: 86.58.145.50
Probable Submitter: 83.91.2.77
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- https://master.php.net/note/edit/76317
Del: integrated -- https://master.php.net/note/delete/76317/integrated
Del: useless -- https://master.php.net/note/delete/76317/useless
Del: bad code -- https://master.php.net/note/delete/76317/bad+code
Del: spam -- https://master.php.net/note/delete/76317/spam
Del: non-english -- https://master.php.net/note/delete/76317/non-english
Del: in docs -- https://master.php.net/note/delete/76317/in+docs
Del: other reasons-- https://master.php.net/note/delete/76317
Reject -- https://master.php.net/note/reject/76317
Search -- https://master.php.net/manage/user-notes.php