I'm wondering of the greatest method of getting rid of some things from the domain using PHP.

For instance:

"http://mydomain.com/" into "mydomain"


"http://mydomain.co.united kingdom/" into "mydomain"

I am searching for a fast function that will permit me to get rid of things like:

"http://", "world wide web.", ".com", ".co.united kingdom", ".internet", ".org", "/" etc

Thanks ahead of time :)

To find the host a part of a URL use parse_url:

$host = parse_url($url, PHP_URL_HOST)

But for the relaxation see my response to Remove domain extension.

Would you use string replace?

str_replace('http://', '')

This could strip out 'http://' from the string. All you would need to do first is obtain the current link to the page and pass it through any string replace you desired to..

I'd str_replace the 'http://' after which explode the periods within the full domain title.