not sure how it can be done, but how can I edit the urls in a string before echoing results from the db?
basically:
the string coming from db:
Hello, I am Terry. I like using
<a href="http://www.twitter.com">Twitter</a>, but I prefer using<a href="http://www.facebook.com">Facebook</a>. I like posting blogs on my website at<a href="http://www.mycoolsite.com">My Cool Site</a>, and I enjoying playing sports.
but I want to echo out:
Hello, I am Terry. I like using
<a href="http://www.somepage.com/home?url=http://www.twitter.com">Twitter</a>, but I prefer using<a href="http://www.somepage.com/home?url=http://www.facebook.com">Facebook</a>. I like posting blogs on my website at<a href="http://www.somepage.com/home?url=http://www.mycoolsite.com">My Cool Site</a>, and I enjoying playing sports.
eg: Replace http://www.twitter.com in href with http://www.somepage.com/home?url=http://www.twitter.com
This is what you are actually looking for,
You can try that code on phpfiddle.org it’s working. Let me know if you need anything change in that.
UPDATED CODE: