little example that I just threw together this might give you some ideas
<?
function phpHighlight($input) {
$text = spliti("\[L\]|\[\/L\]",$input);
for($i = 0; $i < count($text); $i++) {
if(ereg("(<\?)(.*)(\?>)",$text[$i])) {
ob_start();
$text[$i] = ob_get_contents();
ob_end_clean();
}
}
$text = implode("",$text);
return $text;
}
?>