note 16165 deleted from function.highlight-string by didou
| From: | didou@php.net | Date: | Sat, 16 Aug 2003 23:48:07 +0000 |
| Subject: | note 16165 deleted from function.highlight-string by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54519@lists.php.net to get a copy of this message | ||
Note Submitter: lucian@dnt.ro
----
If you dont't like to see the php tags, but you still want to see the php code highlighted, you
can this example<p>
//your text, without php tags
$text=
'echo "this is a php example";
$i = 1;
echo $i;
$i++;
echo "end of text, \$i=$i";';
//text with tags added
$phptext="<?$text?>";
ob_start();
highlight_string($phptext);
//highlighted text
$colorphptext = ob_get_contents();
ob_end_clean();
$pos1 = strpos ($colorphptext,"<?");
$pos2 = strrpos ($colorphptext,"?>");
$colortext = substr($colorphptext, 0, $pos1).substr($colorphptext, $pos1+5,
$pos2-($pos1+5)).substr($colorphptext, $pos2+5);
echo "***$colortext***";