Home  >  Article  >  php教程  >  IP转数字,数字转IP

IP转数字,数字转IP

WBOY
WBOYOriginal
2016-06-13 10:37:40757browse

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

注:这里面有一个要注意的地方,大概由于PHP无法正确判断转换完的数字类型,出现负数的情况。

这时可用bindec(decbin(ip2long($IP))) 处理一下。
 

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