title: IPV4 vs. IPV6 PHP Function
body: <p>I've been reading about how to determine whether an IP is IPv4 or IPv6 and it seems obvious to me that the thing to look for is whether there is a colon. However, then you have IPv4–mapped IPv6 addresses and IPv4–compatible IPv6 addresses. It seems to me that these types of addresses have both colons and periods, so instead of solutions that look for whether there is  no <code>::ffff</code> at the beginning of the string, why not just do this:</p>
  
  <pre><code>function isIPv6($ip) {
    if(strpos($ip, ":") !== false &amp;&amp; strpos($ip, ".") === false) {
       return true;
    }
    return false;
  }
  </code></pre>
  
  <p>EDIT: Am I missing something or would this function work properly in all cases?</p>