How can $_SERVER['HTTP_HOST'] be utilized effectively in PHP for domain-specific operations?

$_SERVER['HTTP_HOST'] can be utilized effectively in PHP for domain-specific operations by allowing you to identify the domain name of the current request. This can be useful for implementing different logic or functionality based on the domain being accessed.

$domain = $_SERVER['HTTP_HOST'];

if($domain == 'example.com'){
    // Perform operations specific to example.com
} elseif($domain == 'anotherdomain.com'){
    // Perform operations specific to anotherdomain.com
} else {
    // Default operations for other domains
}