That works perfect for the example -- Unfortunately, something is causing it no to work with the string I am supplying (which is like 50+ lines of HTML). Hmm...further findings from a Google-cached Russian version of the PHP manual brought me to this (I modified slightly):
function bbcode_php($s) {
// Formats php code inside of [php ][ /php] using highlight_string()
$s = str_replace("]\n", "]", $s);
$match = array('#\[php\](.*?)\[\/php\]#se');
$replace = array("'<div>'.highlight_string(stripslashes('$1'), true).'</div>'");
return preg_replace($match, $replace, $s);
}
...which may actually be a better practice than converting all <code> tags to PHP by default. I'll have to think about this...and keep experimenting with regular expressions.
Thanks for the quick response btw!
aksival