<?php
function url_domain()
{
$curr = strpos($_SERVER['PHP_SELF'], '/') !== false ?
preg_replace('/(.*)()(\/?)(.)*/i', '\1', dirname($_SERVER['PHP_SELF'])) :
dirname($_SERVER['PHP_SELF']);
$root = str_replace('\\', '/', $curr);
if (substr($root, -1) != '/')
{
$root .= '/';
}
return $root;
}
echo(url_domain());exit();
?>