Different approaches to get file extentions by PHP
http://cowburn.info/2008/01/13/get-file-extension-comparison/
$filename = 'mypic.gif';
- The “explode/end” approach
$ext = end(explode('.', $filename));
- The “strrchr” approach
$ext = substr(strrchr($filename, '.'), 1);
- The “strrpos” approach
$ext = substr($filename, strrpos($filename, '.') + 1);
- The “preg_replace” approach
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename);
- The “pathinfo” approach
$filename = 'mypic.gif'; $ext = pathinfo($filename, PATHINFO_EXTENSION);