Calculates network information based on an IP address and netmask.
Fully populates the object properties based on the IP address and netmask/bitmask properties. Once these two fields are populated, calculate() will perform calculations to determine the network and broadcast address of the network.
Return: true if no errors occured, otherwise PEAR_Error object
Determines whether or not the supplied IP is within the supplied network.
This function determines whether an IP address is within a network. The IP address ($ip) must be supplied in dot-quad format, and the network ($network) may be either a string containing a CIDR formatted network definition, or a Net_IPv4 object.
Return: true if the IP address exists within the network
A dot quad representation of an IP address
A string representing the network in CIDR format or a Net_IPv4 object.
Using the PHP long2ip() and ip2long() functions, convert the IP address from a string to a long and back. If the original still matches the converted IP address, it's a valid address. This function does not allow for IP addresses to be formatted as long integers.
There are 33 valid netmask values. This function will compare the string passed as $netmask to the predefined 33 values and return true or false. This is most likely much faster than performing the calculation to determine the validity of the netmask.