In a typical file matching code:
while (false !== ($file = readdir($handle))) {
if ($file !== "." && $file !== ".." && fnmatch($mask, $file)) {
$dirList[] = $file;
}
}
I tried to use the multiple file extension template as follows:
$mask = "*.{jpg,png,gif}";
but that will not work. No files. This is rather strange since the same template works fine in the terminal. It also works great with glob (), returning the files I want. I know that there is nothing wrong with the rest of the code, because using "* .jpg" as a mask also works with fnmatch. Was fnmatch supposed to not support the same patterns that are available in the shell?
source
share