public static function getDomain($url = false)
    {
        if ($url) {
            preg_match('/([\w]+[.]){1,}[a-z]+/', $url, $matches);

            return isset($matches[0]) ? $matches[0] : false;
        }

        return $_SERVER['SERVER_NAME'];
    }
public static function getDomain($url = false)
    {
        if ($url) {
            preg_match('/([\w]+[.]){1,}[a-z]+/', $url, $matches);

            return isset($matches[0]) ? $matches[0] : false;
        }

        return $_SERVER['SERVER_NAME'];
    }
public static function getDomain ( $ url = false ) { if ( $ url ) { preg_match ( '/([\w]+[.]){1,}[a-z]+/' , $ url , $ matches ) ; return isset ( $ matches [ 0 ] ) ? $ matches [ 0 ] : false ; } return $ _SERVER [ 'SERVER_NAME' ] ; }
Get the server name.

@param string $url

@return string|false → server name
Get the server name .