Jump to content


This topic is now archived and is closed to further replies.


string find and replace

Recommended Posts

I am looking to take a string stored in $variable, and search it for the & character, and replace it with '&' without the ' ' before placing into the database.

I find this character breaks the xml feed, and I'd rather not have to edit the database each and every time.

Thanks in advanced to anyone that can help with this trick.

Share this post

Link to post
Share on other sites
// This code will remove the '&' chracters to prevent it from breaking the rss feeds
$oldWord = "&";

// The new word we want in place of the old one
$newWord = "&";

// Run through the text and replaces all occurrences of $oldText
$ArticleBody = str_replace($oldWord , $newWord , $ArticleBody);

figured it out, rock on

Share this post

Link to post
Share on other sites
This topic is now closed to further replies.


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.