cvs: pear /Net_IPv4 IPv4.php

From: Date: Sun, 22 Jun 2003 17:25:32 +0000
Subject: cvs: pear /Net_IPv4 IPv4.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-11120@lists.php.net to get a copy of this message
ekilfoil Sun Jun 22 13:25:32 2003 EDT Modified files: /pear/Net_IPv4 IPv4.php Log: Added some more documentation and use ip2double instead of ip2long to set the 'long' property of the object Index: pear/Net_IPv4/IPv4.php diff -u pear/Net_IPv4/IPv4.php:1.3 pear/Net_IPv4/IPv4.php:1.4 --- pear/Net_IPv4/IPv4.php:1.3 Sun Jun 22 12:57:48 2003 +++ pear/Net_IPv4/IPv4.php Sun Jun 22 13:25:32 2003 @@ -158,6 +158,17 @@ * The third would be [IP Address] [Subnet Mask as Hex string] * 192.168.0.0/ffff0000 * + * Usage: + * + * $cidr = '192.168.0.50/16'; + * $net = Net_IPv4::parseAddress($cidr); + * echo $net->network; // 192.168.0.0 + * echo $net->ip; // 192.168.0.50 + * echo $net->broadcast; // 192.168.255.255 + * echo $net->bitmask; // 16 + * echo $net->long; // 3232235520 (long/double version of 192.168.0.50) + * echo $net->netmask; // 255.255.0.0 + * * @param string $ip IP address netmask combination * @return object true if syntax is valid, otherwise false */ @@ -238,7 +249,7 @@ if (! $this->validateIP($this->ip)) { return($this->raiseError("invalid IP address")); } - $this->long = ip2long($this->ip); + $this->long = $this->ip2double($this->ip); } else if (is_numeric($this->long)) { $this->ip = long2ip($this->long); } else {

« previous php.pear.cvs (#11120) next »