PHP – How to get domain name from URL?
i was working on a recent project and suddenly i wanted to extract domain name domain.tld stripping off www or http://
I know that parse_url() is the function that accomplishes most of the task. I have tested this function and if users type with www.domain.com then domain.com is only available with path array variable and not in host array variable whereas with http:// the domain.com comes in host array. This is a tricky problem when parsing url to get domain …

