note 32301 added to function.highlight-string

From: Date: Fri, 23 May 2003 04:49:56 +0000
Subject: note 32301 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-48858@lists.php.net to get a copy of this message
[qoute]This is my way to highlight a string... If you got a big string with some pieces of php-code in it, it leaves all your text as it is made up with your stylesheets or whatever except for the php code. So it doesn't put your normal text between those <code></code> tags. NOTE: you'll have to put your php-code between [php][/php] tags if you want to use this function. function phpHighlight($input) { $text = spliti("\[php\]|\[\/php\]",$input); for($i = 0; $i < count($text); $i++) { if(ereg("(<\?php)(.*)(\?>)",$text[$i])) { ob_start(); highlight_string($text[$i]); $text[$i] = ob_get_contents(); ob_end_clean(); } else { $text[$i] = nl2br(htmlspecialchars($text[$i])); } } $text = implode("",$text); return $text; } Hope this saves someone some work... ;-) Robert. [/qoute] i try dis but by me he make from dis: <?php $ditiseenvariable = ("Ditisdeinhoud"); ?> dis: ditiseenvariable = ("Ditisdeinhoud"); ?> he hightligh is good when i try to doe dis : [php] <?php $ditiseenvariable = ("Ditisdeinhoud"); ?>[/php] then he put nothing in the screen i hope same one can help me michael ---- Manual Page -- http://www.php.net/manual/en/function.highlight-string.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32301 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32301&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32301&report=yes

« previous php.notes (#48858) next »