I came across the same problem today I got this workign
<?php
$code = "<?php print "hello"; ?>";
ob_start();
highlight_string($code);
$output = ob_get_contents();
ob_end_clean();
print $output;
?>
But what I want to do is a little bit more complex and I'm stuck.
I have a database with a news field
tags like bold can be used
So when I retreive the field I want to replace
code here
with <b> output from highlight_string </b>
But it isn't working, for someone reason it is displaying sixs times, with the text not in the
tag also in bold