Skip to content

Instantly share code, notes, and snippets.

@louisfisch
Last active February 21, 2016 18:17
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 louisfisch/dd2095efd6fd59a15872 to your computer and use it in GitHub Desktop.
Save louisfisch/dd2095efd6fd59a15872 to your computer and use it in GitHub Desktop.
<?php
function dir_to_array($dir_name) {
$files_names = array();
if (is_dir($dir_name)) {
$handle = opendir($dir_name);
while (false !== ($file_name = readdir($handle))) {
$file_path = $dir_name.$file_name;
if (is_file($file_path) && is_readable($file_path)) {
array_push($files_names, $file_name);
}
}
closedir($handle);
}
return $files_names;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment