note 60251 added to function.highlight-string

From: Date: Sat, 31 Dec 2005 09:37:47 +0000
Subject: note 60251 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-101037@lists.php.net to get a copy of this message
to vouksh: I expanded your functions a bit: <?php function xhtmlHighlightString($str,$return=false) { $hlt = highlight_string(stripslashes($str), true); $fon = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $hlt); $ret = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $fon); if($return) return $ret; echo $ret; return true; } function xhtmlHighlightFile($path,$return=false) { $hlt = highlight_file($path, true); $fon = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $hlt); $ret = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $fon); if($return) return $ret; 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+60251 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60251&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60251&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60251&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60251&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60251&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60251&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60251&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60251&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101037) next »