title: php: Get file extension from corrupted file
body: <p>I have a few files that somehow lost their extension due to a bug in a script. So now, I have a folder with many files like "image" or "123" instead of "image.jpg" or "123.pdf". By using finfo, I can grab the mime type. Is something similar in php also possible for the extension so that I can repair them somehow? (It is only the file name - the files didn't get damaged)</p>
  
  <p>I could - of course - create a huge array with possible file types. But this approach is not "safe" enough as there are many file extensions with the same MIME type.</p>