Created
March 22, 2011 18:21
-
-
Save ReneeVandervelde/881738 to your computer and use it in GitHub Desktop.
Returns an array of filenames for a given directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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