0) { return $records[0]['ip']; } return null; } /** * Get the IPv6 address of the given hostname. * * @param $hostname The hostname to resolve * * @return string|null The IPv6 address of the given hostname or null, when no entry exists. */ public static function ipv6($hostname) { $records = dns_get_record($hostname, DNS_AAAA); if ($records !== false && count($records) > 0) { return $records[0]['ip']; } return null; } }