note 76317 deleted from function.scandir by felipe

From: Date: Fri, 29 Aug 2008 23:27:07 +0000
Subject: note 76317 deleted from function.scandir by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-144005@lists.php.net to get a copy of this message
Note Submitter: Anders dot Jenbo at Pc dot DK ---- 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; } }

« previous php.notes (#144005) next »