Return to Snippet

Revision: 53551
at November 27, 2011 14:42 by onigetoc


Initial Code
<?php
$host = $_SERVER['HTTP_HOST'];
preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
echo "domain name is: {$matches[0]}\n";
?>

Initial URL
http://www.appsmobiledev.com/

Initial Description
php get current domain name without www or subdomain

Initial Title
get current domain name without www or subdomain

Initial Tags


Initial Language
PHP