title: PHP function to show both ipv4 ipv6
body: <p>I am configuring a server to be dual stack, allowing both ipv4 and ipv6. Then, I want to create a php page to show if the client machine is conecting via ipv4, ipv6 or both.</p>
  
  <p>I have tried $_SERVER['REMOTE_ADDR'] and getenvbyhost("REMOTE_ADDR") as well, but it returns only one or another never both.</p>
  
  <p>I also tried the below code</p>
  
  <pre><code> function isIPv6($ip) {
  
     if(filter_var($ip, FILTER_VALIDATE_IP)) {
  
       if(filter_var($ip, FILTER_FLAG_IPV6)) {
         //It is IPv6 indeed.
       } else {
         //It is IPv4
       }
  
     } else {
       // Not a valid IP
     }
  }
  </code></pre>
  
  <p>Is it possible to get both ips from the server?</p>