title: PHP Get file name starting with prefix
body: <p>This is a custom function. At the moment, this function get all the file in the default directory, strip ".php" and list them. </p>
  
  <p>The problem is that I want to only get files from the directory which has starting prefix "tpl-" Example : tpl-login-page.php    </p>
  
  <pre><code>/* Get template name of the file */
          function get_template_name (){
              $files = preg_grep('~\.(php)$~', scandir(admin . "templates/default/"));
                  foreach($files as $file){
                      $file = str_replace('.php','',$file);
                      echo $file . "&lt;br/&gt;";
                  }
          }
  </code></pre>