Skip to content

Instantly share code, notes, and snippets.

@thagxt
Last active June 28, 2017 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thagxt/0f35a0682ed76ca73c342c64cc96619b to your computer and use it in GitHub Desktop.
Save thagxt/0f35a0682ed76ca73c342c64cc96619b to your computer and use it in GitHub Desktop.
Remove both http:// & https:// from URL
<?php
$url = "https://example.com/";
$url = preg_replace('/^https?:\/\//', '', $url);
// output: example.com/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment