Skip to content

Instantly share code, notes, and snippets.

@ReneeVandervelde
Created March 22, 2011 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ReneeVandervelde/881738 to your computer and use it in GitHub Desktop.
Save ReneeVandervelde/881738 to your computer and use it in GitHub Desktop.
Returns an array of filenames for a given directory
<?php
/**
* Returns an array of filenames for a given directory
*
* @param string $directory The directory of files to list
* @return array the array of files
*/
function getDirectoryList($directory){
$files= array();
$h = opendir($directory);
while ($file = readdir($h))
if ($file != "." && $file != "..")
$files[] = $file;
closedir($h);
return $files;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment