Home >Backend Development >PHP Tutorial >How to convert IP address to number in php_PHP tutorial

How to convert IP address to number in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 16:56:10958browse

Experienced friends may know that when using libraries like QQIP, the IP addresses we find are all a string of numbers. Let’s tell you how to convert the IP address into numbers.

echo ip2long("192.168.1.189")."
";
echo (192*255*255*255+168*255*255+1*256+189)."
";
?> 
The code is as follows
 代码如下 复制代码

echo ip2long("192.168.1.189")."
"; 
echo (192*255*255*255+168*255*255+1*256+189)."
";
?>    

Copy code

-1062731331 3194548645 http://www.bkjia.com/PHPjc/631622.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/631622.html
TechArticle
Experienced friends may know that when using a library like QQIP, the IP address we find is a string of numbers. , below we will tell you how to implement the method of converting IP address into numbers. The code is like...
Statement:
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