PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Networking » Net_CheckIP » Manual

Package to check the correct syntax of an IPv4 address.

Net_CheckIP::check_ip()

Net_CheckIP::check_ip() – Validation of IPv4 addresses

Synopsis

require_once 'Net/CheckIP.php';

boolean Net_CheckIP::check_ip ( string $ip )

Description

This function can validate if a given string has a valid IPv4 syntax.

Parameter

Return value

boolean - TRUE, if syntax is valid

Note

This function can be called statically.

Example

Using check_ip()

<?php
require_once "Net_CheckIP/CheckIP.php";

if (Net_CheckIP::check_ip("your_ip_goes_here")) {
    // Syntax of the IP is ok
}
?>