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
Post a Comment