note 5012 deleted from Floating point numbers by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Fri, 08 Sep 2000 02:04:41 +0000 |
| Subject: | note 5012 deleted from Floating point numbers by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4467@lists.php.net to get a copy of this message | ||
IP to decimal function.
Note sure if this will work on your system, but this function convert an IP to a decimal value
correctly on my system :
<pre>
function IP2dec($IP)
{
$Dec = 0.0; //force to work with double (32bits)
$val = explode('.', $IP);
for ($i=0; $i<count($val); $i++)
{
$Dec = ($Dec *256.0); //force to work with double
$Dec+=($val[$i]*1.0); //force to work with double
}
Return $Dec;
}
</pre>
Hope it helps,
Laurent.