// get last two segments of host name
preg_match("/[^./]+.[^./]+$/", $host, $matches);Ausgabe?
echo "domain name is: {$matches[0]}<br>\n";
$domain=$matches[0];
Sollte natürlich nicht $host heißen, soondern:
Oder so: Dann gibts die Subdomain....
// get host name from URL
preg_match("/^(http://)?([^/]+)/i",$_SERVER["HTTP_HOST"] , $matches);
$host = $matches[2];
$matched = explode('.',$matches[2]);
$subdomain=$matched[0];
$subdomain2=$matched[1];