Pennimus
03-20-2007, 03:10 PM
Hello,
I have a script that takes a URL and trims characters from it for storage in a database. My intention is to trim http:// from the start of the URL and and trailing slashes. For this I have been using the following:
$url = trim($url, "http://");
Unfortunately a problem has arisen in that any url's ending in .net have "t" trimmed from the end because, I realise, trim() strips out individual characters, not phrases.
Is there any way trim() can be modified to only find and remove the instance of http:// in it's entirety, and ignore single instances of the letters, or is there an alternative function I should be looking at?
I have a script that takes a URL and trims characters from it for storage in a database. My intention is to trim http:// from the start of the URL and and trailing slashes. For this I have been using the following:
$url = trim($url, "http://");
Unfortunately a problem has arisen in that any url's ending in .net have "t" trimmed from the end because, I realise, trim() strips out individual characters, not phrases.
Is there any way trim() can be modified to only find and remove the instance of http:// in it's entirety, and ignore single instances of the letters, or is there an alternative function I should be looking at?