On Thu, Jun 13, 2002 at 03:49:00PM +0100, Brian McGarvie wrote: > $string = '[b]Test[/b]'; > $bbcode_string = str_replace("<", "[", str_replace(">", "]", $string)); > > or look into regular expressions...
It's probably better to do as Brian suggests: use regular expressions so that you can avoid cases like [b onMouseOver="executesomejavascript"]Test[/b] With something like $bbcode_string = preg_replace("/\[(\/?)b\]/i", "<$1b>", $string); > > -----Original Message----- > > From: Erick Lee [mailto:[EMAIL PROTECTED]] > > Sent: 13 June 2002 3:25 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] PCRE Problem > > > > > > > > I want to change it to > > $string = <b>Test</b> > > How? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- James Clifford [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php