59 bool $show_hidden =
false,
60 string $file_type =
"",
62 bool $recursive =
false
67 if (is_dir($directory))
69 $use_skip = !empty($skip);
71 $dir = dir($directory);
72 while (
false !== ($entry = $dir->read()))
75 if (($entry[0] ==
'.') && (
false === $show_hidden))
80 if ((
true === $use_skip) && (in_array($entry, $skip)))
85 if (is_file($directory.
'/'.$entry))
88 $temp_file = $directory.
'/'.$entry;
91 $temp_file = str_replace($strip,
"", $temp_file);
94 if ($file_type ===
"")
96 $result_list[] = $temp_file;
98 if (preg_match(
'/\.'.$file_type.
'$/i', $entry))
100 $result_list[] = $temp_file;
106 if (
true === $recursive)
108 $aTemp =
file_list($directory.
'/'.$entry, $skip, $show_hidden, $file_type, $strip, $recursive);
111 $result_list = array_merge($result_list, $aTemp);
118 natcasesort($result_list);
file_list(string $directory, array $skip=[], bool $show_hidden=false, string $file_type="", string $strip="", bool $recursive=false)