php - exclude file with Glob -


i using glob list of files in directory.

foreach(glob(dirname(__file__) . '/{data-,list-}*.{php}', glob_brace) $filename){        $filename = basename($filename);        echo "<option value='" . $filename . "'>".$filename."</option>";     } 

let file list in directory follow

data-financebyyear.php data-finance.php data-hrbyyear.php 

how exclude files byyear in filename ?

i tried , not working ..all files still displayed

foreach(glob(dirname(__file__) . '/{data-,list-}*.{php}', glob_brace) $filename){        $filename = basename($filename);         if (strpos($filename, 'byyear') !== false) {        echo "<option value='" . $filename . "'>".$filename."</option>";        }     } 

foreach(glob(dirname(__file__) . '/{data-,list-}*.{php}', glob_brace) $filename){        $filename = basename($filename);         if (strpos($filename, 'byyear') === false) {        echo "<option value='" . $filename . "'>".$filename."</option>";        }     } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -