title: Strip the extension from a file
body: <p>I have a code that is working as i want it to apart from 1 problem.</p>
  
  <p>You can see the result here <a href="http://test.whatanswered.com/health/what-can-a-first-aider-do.php" rel="nofollow">http://test.whatanswered.com/health/what-can-a-first-aider-do.php</a> on the right below "Related Articles" showing dead links.</p>
  
  <p>The following is the HTML that should be displayed.</p>
  
  <pre><code>&lt;p&gt;&lt;a href="../health/name-of-the-page.php"&gt;Name of the page&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I would like to strip the dashes and php as above "Name of the page" but it also strips the dashes and php from the url.</p>
  
  <p>The code is:</p>
  
  <pre><code>&lt;?php 
  
  if ($handle = opendir('health')) {
      $fileTab = array();
      while (false !== ($file = readdir($handle))) {
          if ($file != "." &amp;&amp; $file != "..") {
              $fileTab[$file] = strtr(pathinfo($file, PATHINFO_FILENAME), '-', ' '); 
          }
      }
      closedir($handle);
      shuffle($fileTab);
      foreach(array_slice($fileTab, 0, 10) as $file =&gt; $health) {
          $thelist .= '&lt;p&gt;&lt;a href="../health/'.$file.'"&gt;'.$health.'&lt;/a&gt;&lt;/p&gt;';
      }
  }
  ?&gt;
  &lt;?=$thelist?&gt; 
  </code></pre>