Return to Snippet

Revision: 9869
at November 27, 2008 01:18 by sarfraznawaz2005


Initial Code
// function to get current filename from a url made by sarfraz ahmed.
function get_url_filename()
{
	$filename = array_pop(explode("/",$_SERVER['REQUEST_URI']));
	$ext = substr($filename,strpos($filename,"."));
	
	if (substr($ext,4))
	{
		if (substr($ext,4,1)=="?")
		{
			$ext = substr($ext,0,4);
		}
		else
		{
			$ext = substr($ext,0,5);
		}
	}

	$filename = substr($filename,0,strpos($filename,"."));	

	return $filename . $ext;
}

Initial URL


Initial Description
Gets filename from current URL

Initial Title
Gets filename from current URL

Initial Tags
url

Initial Language
PHP