public function getIpVersion($ip)
    {
        if (false !== filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
            return self::IPv6;
        }

        else if (false !== filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            return self::IPv4;
        }
        // invalid ip
        return false;
    }
public function getIpVersion($ip)
    {
        if (false !== filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
            return self::IPv6;
        }

        else if (false !== filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            return self::IPv4;
        }
        // invalid ip
        return false;
    }
public function getIpVersion ( $ ip ) { if ( false !== filter_var ( $ ip , FILTER_VALIDATE_IP , FILTER_FLAG_IPV6 ) ) { return self :: IPv6 ; } else if ( false !== filter_var ( $ ip , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { return self :: IPv4 ; } // invalid ip return false ; }
Get IP verison

@param string $ip
@return integer|boolean Returns version or false on invalid address
Get IP verison