Friday, September 23, 2011

php get domain name from url

Regular Expression probably will be the first idea coming up in your mind. But it turns out the task could be much easier in PHP:

$domain = parse_url($url, PHP_URL_HOST);

No comments: