Created
September 18, 2016 20:22
-
-
Save praisedpk/64bdb80d28144aa78d58469324432277 to your computer and use it in GitHub Desktop.
Get host or domain name from a URL with PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_domain_from_url( $string ) | |
{ | |
return strtolower( parse_url( $string , PHP_URL_HOST ) ); | |
} | |
Source https://pageconfig.com/post/extract-host-from-a-url-php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment