note 56642 added to function.highlight-string

From: Date: Sat, 10 Sep 2005 17:27:46 +0000
Subject: note 56642 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-94993@lists.php.net to get a copy of this message
Fully working, XHTML 1.1 ready xhtml_highlight function. I included the stripslashes, because of some problems I had with out it. It should be safe to leave it in there, but if you experience problems, feel free to take it out. <? function xhtml_highlight($str) { $hlt = highlight_string(stripslashes($str), true); $fon = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $hlt); $ret = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $fon); echo $ret; return true; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.highlight-string.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56642 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56642&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56642&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56642&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56642&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56642&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56642&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56642&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94993) next »