function retrieve($url)
{
preg_match('//([^/]+.[a-z]+)[^/]*$/',$url,$match);
return $match[1];
}
<?PHP
function getExt($url)
{
$path=parse_url($url);
$str=explode('.',$path['path']);
return $str[1];
}
echo getExt('http://www.veryhuo.com//fg.PHP?id=1');
?>