note 59911 deleted from function.ip2long by nlopess
| From: | nlopess@php.net | Date: | Tue, 20 Dec 2005 12:56:13 +0000 |
| Subject: | note 59911 deleted from function.ip2long by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100459@lists.php.net to get a copy of this message | ||
Note Submitter: guto.onideskNO_SPAM.gmail.com
Reason: useless
----
here is a simple function that allows to conver an ip to long
that i use on my projects
function IPAddr2IPNumber($ip_addr)
{
if(empty($ip_addr)){
return false;
}
else{
$ip_parts = explode(".",$ip_addr);
$ip_num = pow(256,3)* $ip_parts[0]+ pow(256,2)*$ip_parts[1]+pow(256,1)*$ip_parts[2]+$ip_parts[3];
}
return $ip_num;
}
Guto Ferreira
http://onidesk.sytes.net