'#\[code\](.*?)\[/code\]#si' => 'Code: <div style="padding: 10px;border:1px dashed; border-color:#FF0000;">'.htmlspecialchars(\\1).'</div>'
htmlspecialchars() is a php function. preg_replace() (what i assume you're using), is also a php function.
These are the signatures for both:
mixed preg_replace ( mixed $pattern, mixed $replacement, mixed $subject [, int $limit [, int &$count]] )
string htmlspecialchars ( string $string [, int $quote_style [, string $charset]] )
Signatures work like this:
return_type function_name ( param_type $variable_name [, optional_param $optional_param] )
What that basically means is, when you are defining the array that contains your bbcode find/replace data, you are defining an array that contains a bunch of regex strings. The strings are then passed to preg_replace() in a certain order so they match and replace the right stuff.
Since php is evaluated one line at a time, when you define the code element of the array, htmlspecialchars() is called with the undefined constant \\1 being passed to a paramater that technically only accepts strings and and arrays. A string is then returned, and the return string is then concatenated into the whole string stored in the array (confusing huh).
So, now that the long boring stuff is out of the way, here's the solution:
http://www.pixel2life.com/forums/index.php...st&p=155294