so working on simple php bbcode system, though doing [center][b][i]text[/i][/b][/center] doesn't parse. leaves couple out. curious if give me tip? or point me in direction learn how fix issue. sample of code: function bbcode($str) { $patterns = array(); $patterns = array( '#\[b\](.*?)\[/b\]#', '#\[i\](.*?)\[/i\]#', '#\[u\](.*?)\[/u\]#', '#\[color=(.*?)\](.*?)\[/color\]#', '#\[img\](.*?)\[/img\]#', '#\[center\](.*?)\[/center\]#', '#\n#' ); $replacements = array(); $replacements = array( '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', '<span style="color:$1">$2</span>', '<img src="$1" style="max-width:45%;"></img>', '<center>$1</center>', '<br/>' ); return preg_replace($patterns, $re...
Comments
Post a Comment