title: PHP, get file name without file extension
body: <p>I have this PHP code:</p>
  
  <pre><code>function ShowFileExtension($filepath)
  {
      preg_match('/[^?]*/', $filepath, $matches);
      $string = $matches[0];
  
      $pattern = preg_split('/\./', $string, -1, PREG_SPLIT_OFFSET_CAPTURE);
  
      if(count($pattern) &gt; 1)
      {
          $filenamepart = $pattern[count($pattern)-1][0];
          preg_match('/[^?]*/', $filenamepart, $matches);
          return strtolower($matches[0]);
      }
  }
  </code></pre>
  
  <p>If I have a file named <code>my.zip</code>, this function returns <code>.zip</code>.</p>
  
  <p>I want to do the reverse, I want the function to return <code>my</code> without the extension.</p>
  
  <p>The file is just a string in a variable.</p>