note 41882 deleted from function.ip2long by felipe
| From: | felipe@php.net | Date: | Tue, 22 Jul 2008 19:10:07 +0000 |
| Subject: | note 41882 deleted from function.ip2long by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142555@lists.php.net to get a copy of this message | ||
Note Submitter: someone at somedomain dot something
----
For those poor little people using PHP 3, here's an ip2long:
<?php
if (!function_exists("ip2long")) {
function ip2long($ip) {
$ex = explode(".", $ip);
if (count($ex)!=4) return -1;
list($a, $b, $c, $d) = $ex;
$a = $a*16777216;
$b = $b*65536;
$c = $c*256;
return $a+$b+$c+$d;
}
}
?>