// loop through the link array, outputting the URL + Link Text
for ($i = 0; $i < sizeof($linkarray[0]); $i++){
echo ($linkarray[2][$i] . " - Link " . $i . "
");
$domain = $linkarray[1][$i];
// get host name from URL
preg_match("/^(http:\/\/)?([^\/]+)/i", $domain, $matches);
$host = $matches[2];
// get last two segments of host name
preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
echo "domain name is: {$matches[0]}\n";