Explode hostname referere

hey all,

what is the best way… to see if a script is executed from the samedomain…
//$st=$_SERVER[“HTTP_REFERER”];

$st=“http://www.domain.nl/folder/test.php”;
$st=preg_replace("/http://.[www.]*/","",$st);
$stA=explode("/",$st);
print $stA[0];

if($stA[0]==’[color=#003366]domain.nl’){[/color]

//like this?

}