$s = $_SERVER['SERVER_NAME'];
  $domain = str_replace('www.','',$s);
echo $domain;