Well.. you can make BBCode work better when you use preg_replace. 'Cause when I type '[ /b]' with the str_replace method there will be a </b> in the source, or with '[ b]' only a never ending bold tag.
preg_replace ('/\[b\](.*?)\[\/b\]/is', '<strong>$1</strong>', $str);
When u use this, it'll only replace when there is a [ b]...[/ b] match Edit; @Topicstarter: You could make a function called 'bbcode' with the text as param, and return de text param, only replaced. Something like this:
function bbcode ( $text ){ $text = preg_replace ('/\[b\](.*?)\[\/b\]/is', '<strong>$1</strong>', $text); // etc // etc return $text;}