public static function ip($check, $type = 'both')
    {
        $type = strtolower($type);
        $flags = 0;
        if ($type === 'ipv4') {
            $flags = FILTER_FLAG_IPV4;
        }
        if ($type === 'ipv6') {
            $flags = FILTER_FLAG_IPV6;
        }

        return (bool)filter_var($check, FILTER_VALIDATE_IP, ['flags' => $flags]);
    }
public static function ip($check, $type = 'both')
    {
        $type = strtolower($type);
        $flags = 0;
        if ($type === 'ipv4') {
            $flags = FILTER_FLAG_IPV4;
        }
        if ($type === 'ipv6') {
            $flags = FILTER_FLAG_IPV6;
        }

        return (bool)filter_var($check, FILTER_VALIDATE_IP, ['flags' => $flags]);
    }
public static function ip ( $ check , $ type = 'both' ) { $ type = strtolower ( $ type ) ; $ flags = 0 ; if ( $ type === 'ipv4' ) { $ flags = FILTER_FLAG_IPV4 ; } if ( $ type === 'ipv6' ) { $ flags = FILTER_FLAG_IPV6 ; } return ( bool ) filter_var ( $ check , FILTER_VALIDATE_IP , [ 'flags' => $ flags ] ) ; }
Validation of an IP address.

@param string $check The string to test.
@param string $type The IP Protocol version to validate against
@return bool Success
Validation of an IP address .