Site Tools


# $EPIC: nametoip.txt,v 1.2 2006/08/01 05:32:26 sthalik Exp $


$iptoname(<ip address>)


These functions are used to convert an IP address to a hostname, and vice versa. The $iptoname() function returns the hostname associated with the given IP address, and $nametoip() does the opposite.


These functions are used to convert between IP addresses and Internet hostnames. Obvious reasons aside, they are mostly useful when you know which of the two the input will be. They return nothing if the address could not be converted, or if the input was invalid. The $convert() function should be used if the input is known to vary.


iptoname: hostname for the given IP address
nametoip: IP address for the given hostname


$iptoname(         probably returns "localhost"
$nametoip(localhost)         probably returns ""
$iptoname(localhost)         error, input is not an IP address
$nametoip(         error, input is not a hostname
nametoip.txt · Last modified: 2006/08/01 20:54 by