I have the following code:
$url=$_SERVER['HTTP_HOST']; // www.abc.alpha.beta.xyz
$url=strtolower($url);
$rwww=str_replace("www.", "", $url);
But this results in abc.alpha.beta.xyz, the desired result is abc. How can I get just the first subdomain, ignoring www if present?