public function host(bool $with_port = true): string
    {
        if (($host = &$this->cacheKey(__FUNCTION__, $with_port)) !== null) {
            return $host; // Cached this already.
        }
        $host = mb_strtolower($_SERVER['HTTP_HOST']);

        if (!$with_port) { // Strip port number?
            $host = preg_replace('/\:[0-9]+$/u', '', $host);
        }
        return $host; // With or without port number.
    }
public function host(bool $with_port = true): string
    {
        if (($host = &$this->cacheKey(__FUNCTION__, $with_port)) !== null) {
            return $host; // Cached this already.
        }
        $host = mb_strtolower($_SERVER['HTTP_HOST']);

        if (!$with_port) { // Strip port number?
            $host = preg_replace('/\:[0-9]+$/u', '', $host);
        }
        return $host; // With or without port number.
    }
public function host ( bool $ with_port = true ) : string { if ( ( $ host = & $ this -> cacheKey ( __FUNCTION__ , $ with_port ) ) !== null ) { return $ host ; // Cached this already. } $ host = mb_strtolower ( $ _SERVER [ 'HTTP_HOST' ] ) ; if ( ! $ with_port ) { // Strip port number? $ host = preg_replace ( '/\:[0-9]+$/u' , '' , $ host ) ; } return $ host ; // With or without port number. }
Current host name; lowercase.

@since 150424 Initial release.

@param bool $with_port With port number?

@return string Current host name; lowercase.
Current host name ; lowercase .