lundi 20 avril 2015

Filter by extensions and file names

I have this code located below. I have noticed that I am starting to add more files which is files to be filtered which is fine however now I will like to add extensions.

So anything which is a jpg, mp3 or vtr would also be excluded. TO be honest I am not sure 100% how to approach this. I have tried with no success.

$folder = scandir($path);
$files = array();
foreach($folder as $file){
    if($file == '.' OR $file == '..' OR $file == 'index.htm'  OR $file == 'index.html' OR $file == 'jpg'){}else{
        $files[$file] = filemtime($path.'/'.$file);     
    }
}

Aucun commentaire:

Enregistrer un commentaire