php url string interception path file name and extension
function retrieve($url)
{
preg_match('//([^/]+.[a-z]+)[^/]*$/',$url,$match);
return $match[1];
}
function getExt($url)
{
$path=parse_url($url);
$str=explode('.',$path['path']);
return $str[1];
}
echo getExt('http://www.bkjia.com/ /fg.php?id=1');
?>