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

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -