Gerard-Meier

scandirSorted

May 26th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  1. function scandirSorted($path) {
  2.     $sortedData = array();
  3.     foreach(scandir($path) as $file) {
  4.         if(is_file($path . $file)) {
  5.             array_push($sortedData, $file);
  6.         } else {
  7.             array_unshift($sortedData, $file);
  8.         }
  9.     }
  10.     return $sortedData;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment