There are number of way to get file extension in php.
function getFileExtension($filename)
{
$fileinfo= pathinfo($filename);
return $fileinfo['extension'];
}
$ext = end(explode(‘.’, $file));
$ext = substr(strrchr($file, ‘.’), 1);
$ext = substr($file, strrpos($file, '.') + 1);
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $file);
$exts =split("[/\\.]", $file);
$n = count($exts)-1;
$ext = $exts[$n];
