cvs: pear /Net_IPv4 IPv4.php
| From: | Eric Kilfoil | Date: | Sun, 22 Jun 2003 16:57:48 +0000 |
| Subject: | cvs: pear /Net_IPv4 IPv4.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-11119@lists.php.net to get a copy of this message | ||
ekilfoil Sun Jun 22 12:57:48 2003 EDT
Modified files:
/pear/Net_IPv4 IPv4.php
Log:
Added ip2double. This will return a PHP double instead of a long, solving
the signed long problem.
Index: pear/Net_IPv4/IPv4.php
diff -u pear/Net_IPv4/IPv4.php:1.2 pear/Net_IPv4/IPv4.php:1.3
--- pear/Net_IPv4/IPv4.php:1.2 Sat Jan 4 06:55:47 2003
+++ pear/Net_IPv4/IPv4.php Sun Jun 22 12:57:48 2003
@@ -289,6 +289,14 @@
}
return(FALSE);
}
+ /**
+ * Converts an IP address to a PHP double. Better than ip2long because
+ * a long in PHP is a signed integer.
+ */
+ function ip2double($ip)
+ {
+ return((double)(sprintf("%u", ip2long($ip))));
+ }
}
?>