function isLive($liveTld = ".de")
{
$homeUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']
=== 'on' ? "https" : "http")."://$_SERVER[HTTP_HOST]";
$returnMe = false;
if (
(!(strpos($homeUrl, ".local") !== false))
&&
(!(strpos($homeUrl, ".intra") !== false))
&&
(!(strpos($homeUrl, "stage") !== false))
&&
(!(strpos($homeUrl, "staging") !== false))
&&
(strpos($homeUrl, $liveTld) !== false)
) {
$returnMe = true;
}
return $returnMe;
}

PHP Snippet: Check if code is running on a production environment
von