First use preg_match to extract the contents of the [code][/code] tags, and highlight_code() that.
Use the results to preg_replace() the code area in the original string with the highlighted code. Pseudocode-ish:
$code = preg_match(/code pattern/, $string);
$code = highlight_code($code);
$string = preg_replace(/code pattern/, $code, $string);
Hope it works.
Jonah Bron
2010-02-22 20:40:04