Are there any best practices for handling domain availability checks in PHP scripts?

When handling domain availability checks in PHP scripts, it is important to use a reliable and efficient method to check the availability of a domain name. One common approach is to use the `checkdnsrr()` function in PHP, which checks the DNS records for a given domain name. Additionally, it is recommended to handle errors gracefully and provide informative messages to users if a domain is unavailable.

$domain = 'example.com';

if(checkdnsrr($domain, 'ANY')) {
    echo "Domain $domain is available.";
} else {
    echo "Domain $domain is not available.";
}