note 10497 added to ip2long
| From: | Joerg at php2 dot chek dot com | Date: | Sun, 07 Jan 2001 21:41:53 +0000 |
| Subject: | note 10497 added to ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9456@lists.php.net to get a copy of this message | ||
I've found, that the function returns the integer in a signed format. That isn't
applicable, if you want to use the number in an url, such:
http://3232261145/index.php
This is often used to fake site-urls ;-)
To convert to unsigned long, use the following work around:
$l = ip2long($ip);
if($l < 0) $l += pow(2,32);
$l ist than an unsigned integer.
http://www.php.net/manual/function.ip2long.php