public function getTopLevelDomain()
    {
        if ($this->getIpAddress() !== null) {
            return '';
        }

        $host = rawurldecode($this->getHost());
        $tld = strrchr($host, '.');

        if ($tld === '.') {
            $host = substr($host, 0, -1);
            $tld = strrchr($host, '.');
        }

        return $tld === false ? $host : substr($tld, 1);
    }
public function getTopLevelDomain()
    {
        if ($this->getIpAddress() !== null) {
            return '';
        }

        $host = rawurldecode($this->getHost());
        $tld = strrchr($host, '.');

        if ($tld === '.') {
            $host = substr($host, 0, -1);
            $tld = strrchr($host, '.');
        }

        return $tld === false ? $host : substr($tld, 1);
    }
public function getTopLevelDomain ( ) { if ( $ this -> getIpAddress ( ) !== null ) { return '' ; } $ host = rawurldecode ( $ this -> getHost ( ) ) ; $ tld = strrchr ( $ host , '.' ) ; if ( $ tld === '.' ) { $ host = substr ( $ host , 0 , - 1 ) ; $ tld = strrchr ( $ host , '.' ) ; } return $ tld === false ? $ host : substr ( $ tld , 1 ) ; }
Returns the top level domain from the host component.

Note that if the host component represents an IP address, an empty string
will be returned instead. Additionally, if the host component ends in a
period, the section prior that period will be returned instead. If no
period is present in the host component, the entire host component will
be returned.

@return string The top level domain or an empty string, if no TLD is present
Returns the top level domain from the host component .