[b]lol[/b]'; function bbcode() { $string = str_replace(array('<', '>'), array('<', '>'), $str); $match = array( '#\[b\](.*?)\[\/b\]#se', '#\[i\](.*?)\[\/i\]#se', '#\[u\](.*?)\[\/u\]#se', '#\[s\](.*?)\[\/s\]#se', '#\[url=(.*?)\](.*?)\[\/url\]#se', '#\[url](.*?)\[\/url\]#se', '#\[email\](.*?)\[\/email\]#se', '#\[img](.*?)\[\/img\]#se', '#\[img alt=(.*?)](.*?)\[\/img\]#se' ); $replace = array( "'\\1'", "'\\1'", "'\\1'", "'\\1'", "'\\2'", "'' . fix_url('\\1') . ''", "'\\1'", "'\"BROKEN'", "'\"\\1\"'" ); $string = preg_replace($match, $replace, $string); } bbcode($post); ?>