[Solved] How do i only remove “http://” and “http://www”? [closed]
You should not just use str_replace and using regular expressions seem overkill as well. Keep it simple and test for the beginning of the strings and just use the substring of what you actually want: function trimUrl($url) { if (strpos($url, ‘http://www.’) === 0) { return substr($url, 11); } if (strpos($url, ‘http://’) === 0) { return … Read more