title: Remove extension using str_replace when echoing using glob
body: <p>I have a page where I want to list all of the documents a user has uploaded, and want to remove the extension from each item that is listed.</p>
  
  <p>This list will contain potentially limitless filetypes, so the method that I was using of manually specifying and replacing the extension with nothing, will take too long.</p>
  
  <p>I also tried to do a <code>str_replace</code> on <code>.*</code> so that anything after the <code>.</code> is replaced, but that did not seem to work.</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>&lt;?php 
  $chkdir = is_dir("/secure/user uploads/".$_SESSION['SESS_MEMBER_ID']."");
  $path = "$chkdir/";
  foreach (glob("$path*") as $filename) { 
  $result = str_replace("$path","", $filename); 
  $result = str_replace(".pdf","", $result); 
  $result = str_replace(".db","", $result); 
  echo "&lt;li&gt;&lt;a href='" . $filename ."'/&gt;". $result . "&lt;/a&gt;&lt;/li&gt;&lt;tr&gt;"; 
  } 
  ?&gt;
  </code></pre>
  
  <p>You can see near the end that I specified PDF and DB as file extensions to remove, but I want to try a more general approach, and remove all file extensions.</p>
  
  <p>Can anyone advise with this?</p>