Home > Backend Development > PHP Tutorial > php function long2ip and ip2long

php function long2ip and ip2long

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 09:11:27
Original
1564 people have browsed it

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:

php function long2ip and ip2long

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.

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template