Home >Backend Development >PHP Tutorial >Convert IP to number, convert number to IP_PHP tutorial

Convert IP to number, convert number to IP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:38:49944browse

echo $a=ip2long ("202.97.224.68");
echo "
-
";
echo long2ip ($a);

Note: There is something to note here. Probably because PHP cannot correctly determine the converted number type, negative numbers appear.

At this time, you can use bindec(decbin(ip2long($IP))) to process it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486453.htmlTechArticleecho $a=ip2long (202.97.224.68); echo br /-br /; echo long2ip ($a) ; Note: There is something to note here. Probably because PHP cannot correctly determine the converted number type, negative...
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