fris
public text v1 · immutable<?
//$host = $_SERVER['HTTP_HOST']; need to match www.domain.com
$host = "http://www.domain.com";
if (preg_match("/^https?:\/\/.*?([^\.]+)\.(com|net|org|co\.uk|info|us\.com)/", $host, $matches) ){
$len = intval(strlen($matches[1])/2);
$first_half = substr($matches[1],0,$len);
$second_half = substr($matches[1],$len);
echo "$first_half $second_half";
}
?>