src/net/NetTools.php
public static function getHostByAddress($ipAddress) {
        if (!is_string($ipAddress)) throw new IllegalTypeException('Illegal type of parameter $ipAddress: '.gettype($ipAddress));
        if ($ipAddress == '')       throw new InvalidArgumentException('Invalid argument $ipAddress: "'.$ipAddress.'"');

        $result = gethostbyaddr($ipAddress);

        if ($result==='localhost' && !strStartsWith($ipAddress, '127.'))
            $result = $ipAddress;

        return $result;
    }
public static function getHostByAddress($ipAddress) {
        if (!is_string($ipAddress)) throw new IllegalTypeException('Illegal type of parameter $ipAddress: '.gettype($ipAddress));
        if ($ipAddress == '')       throw new InvalidArgumentException('Invalid argument $ipAddress: "'.$ipAddress.'"');

        $result = gethostbyaddr($ipAddress);

        if ($result==='localhost' && !strStartsWith($ipAddress, '127.'))
            $result = $ipAddress;

        return $result;
    }
public static function getHostByAddress ( $ ipAddress ) { if ( ! is_string ( $ ipAddress ) ) throw new IllegalTypeException ( 'Illegal type of parameter $ipAddress: ' . gettype ( $ ipAddress ) ) ; if ( $ ipAddress == '' ) throw new InvalidArgumentException ( 'Invalid argument $ipAddress: "' . $ ipAddress . '"' ) ; $ result = gethostbyaddr ( $ ipAddress ) ; if ( $ result === 'localhost' && ! strStartsWith ( $ ipAddress , '127.' ) ) $ result = $ ipAddress ; return $ result ; }
Return the host name of the Internet host specified by a given IP address. Additionally checks the result returned
by the built-in PHP function for plausibility.

@param  string $ipAddress - the host IP address

@return string|bool - the host name on success, the unmodified IP address on failure, or FALSE on malformed input
Return the host name of the Internet host specified by a given IP address . Additionally checks the result returned by the built - in PHP function for plausibility .