long2ip — Converts an long integer address into a string in (IPv4) Internet standard dotted format
string long2ip ( string $proper_address )
The function long2ip() generates an Internet address in dotted format (i.e.: aaa.bbb.ccc.ddd) from the long integer representation
It means: used to convert a digital IPv4 address into a string format (192.168.0.1)
And ip2long is just the opposite
Converts an long integer address into a string in (IPv4) Internet standard dotted format
eg:
$ip = gethostbyname('www.csdn.net');
$num_ip = ip2long($ip);
echo $num_ip,'
';
echo long2ip($num_ip);
?>
Result:
The above introduces the PHP functions long2ip and ip2long, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.