title: PHP how to remove the last part of a filename after underscore
body: <p>A filename looks like <code>whatever_test_123234545.gif</code>. </p>
  
  <p>What is the easiest way to remove the last underscore followed by all characters and numbers after it but not the the dot extension.  </p>
  
  <p>In other words i want <code>whatever_test_123234545.gif</code> to look like <code>whatever_test.gif</code>. A filename can have a random number of underscores. I just want to remove the last part before <code>.ext</code>.</p>