public static function ip_match($ip, $match)
    {
        if (ip2long($match)) {//is an actual IP
            if ($ip == $match) {
                return true;
            }
        } else {//is something weird
            if (strpos($match, '/')) {//if it's a cidr notation
                if (self::cidr_match($ip, $match)) {
                    return true;
                }
            } else {//is a random string (let's say a host name)
                $match = gethostbyname($match);
                if ($ip == $match) {
                    return true;
                } else {
                    return false;
                }
            }
        }
        return false;
    }
public static function ip_match($ip, $match)
    {
        if (ip2long($match)) {//is an actual IP
            if ($ip == $match) {
                return true;
            }
        } else {//is something weird
            if (strpos($match, '/')) {//if it's a cidr notation
                if (self::cidr_match($ip, $match)) {
                    return true;
                }
            } else {//is a random string (let's say a host name)
                $match = gethostbyname($match);
                if ($ip == $match) {
                    return true;
                } else {
                    return false;
                }
            }
        }
        return false;
    }
public static function ip_match ( $ ip , $ match ) { if ( ip2long ( $ match ) ) { //is an actual IP if ( $ ip == $ match ) { return true ; } } else { //is something weird if ( strpos ( $ match , '/' ) ) { //if it's a cidr notation if ( self :: cidr_match ( $ ip , $ match ) ) { return true ; } } else { //is a random string (let's say a host name) $ match = gethostbyname ( $ match ) ; if ( $ ip == $ match ) { return true ; } else { return false ; } } } return false ; }
a helper function for test_ip
@param  string $ip the ip address of most any form to test
@param  string $match the ip to perform a matching truth test
@return bool        return true/false depends on if the first ip match the second ip
a helper function for test_ip