source/NetworkComponentsByDanielGP.php
public function checkIpIsV4OrV6($ipGiven)
    {
        if (filter_var($ipGiven, FILTER_VALIDATE_IP)) {
            if (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                return 'V4';
            } elseif (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                return 'V6';
            }
        }
        return 'invalid IP';
    }
public function checkIpIsV4OrV6($ipGiven)
    {
        if (filter_var($ipGiven, FILTER_VALIDATE_IP)) {
            if (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                return 'V4';
            } elseif (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                return 'V6';
            }
        }
        return 'invalid IP';
    }
public function checkIpIsV4OrV6 ( $ ipGiven ) { if ( filter_var ( $ ipGiven , FILTER_VALIDATE_IP ) ) { if ( filter_var ( $ ipGiven , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { return 'V4' ; } elseif ( filter_var ( $ ipGiven , FILTER_VALIDATE_IP , FILTER_FLAG_IPV6 ) ) { return 'V6' ; } } return 'invalid IP' ; }
Checks if given IP is a V4 or V6

@param ipv4 $ipGiven
@return string
Checks if given IP is a V4 or V6