8
down vote
If you want more than one extension searched, then preg_grep() is an alternative for filtering:
Code:
$files = preg_grep('~\.(jpeg|jpg|png)$~', scandir($dir_f));
Though glob has a similar extra syntax. This mostly makes sense if you have further conditions, add the ~i flag for case-insensitive, or can filter combined lists.
or
glob("{$dir}*.{jpg,*jpeg,gif,ico,png}", GLOB_BRACE). This would work as well for multiple extensions.