Guest User

Untitled

a guest
Jan 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. function getDirectoryList ($directory)
  4. {
  5.  
  6. // create an array to hold directory list
  7. $results = array();
  8.  
  9. // create a handler for the directory
  10. $handler = opendir($directory);
  11.  
  12. // open directory and walk through the filenames
  13. while ($file = readdir($handler)) {
  14.  
  15. // if file isn't this directory or its parent, add it to the results
  16. if ($file != "." && $file != "..") {
  17. $results[] = $file;
  18. }
  19.  
  20. }
  21.  
  22. // tidy up: close the handler
  23. closedir($handler);
  24.  
  25. // done!
  26. return $results;
  27.  
  28. }
  29.  
  30. ?>
Add Comment
Please, Sign In to add comment