Skip to content

Instantly share code, notes, and snippets.

@daGrevis
Created September 29, 2011 09:40
Show Gist options
  • Save daGrevis/1250407 to your computer and use it in GitHub Desktop.
Save daGrevis/1250407 to your computer and use it in GitHub Desktop.
Get file's extension, the simple and fast way
<?php
echo pathinfo($filename, PATHINFO_EXTENSION);
// Where `$filename` can be path to file, only file etc..
// P.S. Of course, it can be `exe` file, just renamed to `virus.exe.jpg`, and it will say that it's `jpg`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment