How can PHP be used to check if an email address is valid based on the domain?

To check if an email address is valid based on the domain, we can use PHP to verify the domain part of the email address. This can be done by extracting the domain from the email address and then checking if the domain has a valid DNS record. We can use functions like `checkdnsrr()` in PHP to perform this check.

$email = "example@example.com";
list($user, $domain) = explode('@', $email);
if(checkdnsrr($domain, "MX")){
    echo "Email domain is valid";
} else {
    echo "Email domain is not valid";
}