BB Code issue PHP

baby jesus

New Member
Alright so I am using a little bbcode function for a forum I have, working well, so if, in example, I put\[code\]Text\[/code\]it will print Text in bold.My issue is, if I have that code:\[code\]Text\[/code\]Well it will not work, and just print that as it's right now.Here is an example of the function I am using:\[code\]function BBCode ($string) {$search = array( '#\[b\](.*?)\[/b\]#',);$replace = array( '<b>\\1</b>',);return preg_replace($search , $replace, $string);}\[/code\]Then when echo'ing it:\[code\].nl2br(stripslashes(BBCode($arr_thread_row[main_content]))).\[/code\]So my question would be, what is necessary so the BBcode works with everything inside it, but no necessarily on the same line.In example:\[code\]Text\[/code\]Would simply beTextThank you for any help!Alex
 
Back
Top