What are the best practices for determining domain availability in PHP, considering DNS resolution?

When determining domain availability in PHP, it is important to consider DNS resolution to ensure accurate results. One common approach is to use the `checkdnsrr()` function in PHP, which checks if a given domain has any DNS records associated with it. By checking for DNS records, we can determine if a domain is already in use or available for registration.

function isDomainAvailable($domain) {
    return checkdnsrr($domain, 'ANY');
}

$domain = 'example.com';
if(isDomainAvailable($domain)) {
    echo "Domain $domain is available!";
} else {
    echo "Domain $domain is not available.";
}