note 66327 added to function.scandir
| From: | gregatsassesdotnet at osu1 dot php dot net | Date: | Fri, 19 May 2006 07:27:43 +0000 |
| Subject: | note 66327 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111648@lists.php.net to get a copy of this message | ||
A minor revision to elbekko at gmail dot com <PHP5 scandir function. The arsort should be rsort.
Here is the complete function with the correction:
<?php
if(!function_exists('scandir')) {
function scandir($dir, $sortorder = 0) {
if(is_dir($dir)) {
$dirlist = opendir($dir);
while( ($file = readdir($dirlist)) !== false) {
if(!is_dir($file)) {
$files[] = $file;
}
}
($sortorder == 0) ? asort($files) : rsort($files); // arsort was replaced with rsort
return $files;
} else {
return FALSE;
break;
}
}
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 71.38.29.138
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- http://master.php.net/note/edit/66327
Del: integrated -- http://master.php.net/note/delete/66327/integrated
Del: useless -- http://master.php.net/note/delete/66327/useless
Del: bad code -- http://master.php.net/note/delete/66327/bad+code
Del: spam -- http://master.php.net/note/delete/66327/spam
Del: non-english -- http://master.php.net/note/delete/66327/non-english
Del: in docs -- http://master.php.net/note/delete/66327/in+docs
Del: other reasons-- http://master.php.net/note/delete/66327
Reject -- http://master.php.net/note/reject/66327
Search -- http://master.php.net/manage/user-notes.php