PHP dirname


dirname() retrieves the directory name of a file path.

<?PHP
	$file="C:\Windows\win.ini";
    echo dirname($file); //C:\Windows
?>

It also supports URL file name.
<?PHP
	$file="http://www.endmemo.com/program/php/dirname.php";
    echo dirname($file);
	//http://www.endmemo.com/program/php
?>