Example user input
http://domain.com/
http://domain.com/topic/
http://domain.com/topic/cars/
http://www.domain.com/topic/questions/
I want
Found this http://refactormycode.com/codes/598-remove-http-from-url-string
function remove_http($url = '')
{
if ($url == 'http://' OR $url == 'https://')
{
return $url;
}
$matches = substr($url, 0, 7);
if ($matches=='http://')
{
$url = substr($url, 7);
}
else
{
$matches = substr($url, 0, 8);
if ($matches=='https://')
$url = substr($url, 8);
}
return $url;
}