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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -