Help needed with str_replace or lTrim

Hi there everyone, hope you all are well? My name is Andrew, from South Africa and need a bit of assistance please. I have a snippet of code that gets used on an Admanager on a website. The Add manager allows you to specify a URL on the back end to that image that opens in a new window and the field in the DB is called ‘url’. My problem is that the snippet contains the actual websites url followed by / and then the specified url in the backend, ex: google.com like this: www.mywebsite.com/google.com

I need to remove the www.mywebsite.com/ from the entire url and have the following snippet, and it is not working.

[php]echo “<a href=’”.str_replace("www.mywebsite.com/","","{$row[‘url’]}")." ’ target=’{$row[‘target’]}’ url=’{$row[‘url’]}’>[/php]

Any help would be appreciated.

Thank you.

Can you give some more examples of $row[‘url’] ?

[php]
$uri = “www.mywebsite.com/google.com”;
echo substr(strstr($uri, ‘/’), 1); // google.com
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service