Net_CheckIP2
[ class tree: Net_CheckIP2 ] [ index: Net_CheckIP2 ] [ all elements ]

Class: Net_CheckIP2

Source Location: /Net_CheckIP2-1.0.0RC3/Net/CheckIP2.php

Class Overview


Class to validate the syntax of IPv4 adresses


Author(s):

Version:

  • Release: @package_version@

Methods


Inherited Variables

Inherited Methods


Class Details

[line 59]
Class to validate the syntax of IPv4 adresses

Usage:

  1.    <?php
  2.    require_once 'Net/CheckIP2.php';
  3.  
  4.    if (Net_CheckIP2::isValid("your_ip_goes_here")) {
  5.        // Syntax of the IP is ok
  6.    }
  7.    ?>



[ Top ]


Method Detail

getClass   [line 84]

mixed getClass( string $ip)

Return the class of the IP.
  • Return: A constant that represents the class, or false.
  • Access: public
  • Uses: self::isValid()
  • Uses: self::CLASS_C
  • Uses: self::CLASS_B
  • Uses: self::CLASS_A

Parameters:

string   $ip     The IP address.

[ Top ]

isReserved   [line 127]

boolean isReserved( string $ip)

Checks if the IP address is reserved (according to RFC1918).

Reserved IP addresses are:

  • 10.x.x.x
  • 192.168.x.x
  • 172.16.0.0 to 172.31.255.255


Parameters:

string   $ip     The IP address.

[ Top ]

isValid   [line 171]

boolean isValid( string $ip)

Validate the syntax of the given IP adress

This function splits the IP address in 4 pieces (separated by ".") and checks for each piece if it's an integer value between 0 and 255. If all 4 parameters pass this test, the function returns true.

This replaces Net_CheckIP2::check_ip()!

  • Access: public

Parameters:

string   $ip     The IP address.

[ Top ]

isZeroconf   [line 201]

boolean isZeroconf( string $ip)

Zeroconf - automatically created usable IPs without manual intervention or management/configuration servers. This includes IPs from 169.254.0.0 to 169.254.255.255.

Parameters:

string   $ip     The IP address.

[ Top ]


Documentation generated on Wed, 30 Sep 2009 16:00:02 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.