Пример:
<?php
if (preg_match('/^([^.]+)\.profiwm\.com/i', $_SERVER['HTTP_HOST'], $domain));
$subdomain = $domain[1];
echo $subdomain;
?>
<?php
if (preg_match('/^([^.]+)\.profiwm\.com/i', $_SERVER['HTTP_HOST'], $domain));
$subdomain = $domain[1];
echo $subdomain;
?>