Created
February 28, 2018 12:01
-
-
Save kevsersrca/b1e7c3aed509df15de6021b285d9dbe2 to your computer and use it in GitHub Desktop.
Clean url
This file contains hidden or 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
public function cleanUrl($url) { | |
if (strpos($url, 'https://') > -1) { | |
$clean = array_filter(explode("https://", $url)); | |
return $this->cleanUrl($clean[1]); | |
} | |
if (strpos($url, 'http://') > -1) { | |
$clean = array_filter(explode("http://", $url)); | |
return $this->cleanUrl($clean[1]); | |
} | |
if (strpos($url, "/") > -1) { | |
$clean = array_filter(explode("/", $url)); | |
return $this->cleanUrl($clean[0]); | |
} | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment