mmm, this seems a better way.
PHP Code:
<?php
//Get the web site address
preg_match("/^(http:\/\/)?([^\/]+)/i", "http://www.multi.part.domain.name.com/index.html", $matches);
$host = $matches[2];
// get all but one segments of host name
preg_match_all("/\.([^\.\/]+)/",$host,$matches);
// first element does not want the period('.')
$matches[0][0] = $matches[1][0];
$domain = implode('',$matches[0]);
echo( "Domain: " . $domain);
?>