note 16165 added to function.highlight-string

From: Date: Thu, 18 Oct 2001 13:53:56 +0000
Subject: note 16165 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-19091@lists.php.net to get a copy of this message
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,"&lt;?"); $pos2 = strrpos ($colorphptext,"?&gt;"); $colortext = substr($colorphptext, 0, $pos1).substr($colorphptext, $pos1+5, $pos2-($pos1+5)).substr($colorphptext, $pos2+5); echo "***$colortext***"; -- http://www.php.net/manual/en/function.highlight-string.php http://master.php.net/manage/user-notes.php?action=edit+16165 http://master.php.net/manage/user-notes.php?action=delete+16165 http://master.php.net/manage/user-notes.php?action=reject+16165

« previous php.notes (#19091) next »