I have this code right here:
// get host name from URL
preg_match('@^(?:http://)?([^/]+)@i',
"http://www.joomla.subdomain.php.net/index.html", $matches);
$host = $matches[1];
// get last two segments of host name
preg_match('/[^.]+.[^.]+$/', $host, $matches);
echo "domain name is: {$matches[0]}
";
The output will be php.net
I need just php
without .net
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…