Skip to content

Instantly share code, notes, and snippets.

@JonnyNineToes
Last active December 22, 2015 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonnyNineToes/6425722 to your computer and use it in GitHub Desktop.
Save JonnyNineToes/6425722 to your computer and use it in GitHub Desktop.
Get top level domain with PHP. The code should return ".com", depending on what website you're on, and can be customized for other top level domains (useful for development if you have a ".dev" domain set up on your local machine).
end(explode('.', $_SERVER['SERVER_NAME']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment