Net_CheckIP2::isValid()

Net_CheckIP2::isValid() – Validation of IPv4 addresses

Synopsis

require_once 'Net/CheckIP2.php';

boolean Net_CheckIP2::isValid ( string $ip )

Description

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

Parameter

  • string $ip - the IP address to check

Return value

boolean - TRUE, if syntax is valid

Note

This function can be called statically.

Example

Using isValid()

<?php
require_once 'Net_CheckIP2/CheckIP.php';

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