Jump to content

string find and replace


Dville

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.
Link to comment
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
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

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.