I want all CSV files in a directory, so I use
glob(\'my/dir/*.CSV\')
This however doesn\'t find files with a lowercase CSV extension.
You can also filter out the files after selecting all of them
foreach(glob('my/dir/*') as $file){
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if(!in_array($ext, array('csv'))){
continue;
}
... do stuff ...
}
performance wise this might not be the best option if for example you have 1 million files that are not csv in the folder.