highlight_string

(PHP 4, PHP 5, PHP 7)

highlight_stringDestaque da sintaxe de uma string

Descrição

mixed highlight_string ( string $str [, bool $return ] )

A função highlight_string() mostra o destaque da sintaxe para o parâmetro str usando as cores definidas para o destacador de sintaxe do PHP.

Se o segundo parâmetro return for TRUE então a função highlight_string() irá retornar o código com a sintaxe destacada ao invés de mostrá-lo. Se o segundo parâmetro não for TRUE então highlight_string() irá retornar TRUE se funcionar, FALSE se ocorrer falha.

Exemplo #1 Exemplo highlight_string()

<?php
highlight_string
('<?php phpinfo(); ?>');
?>

O exemplo acima irá mostrar (no PHP 4):

<code><font color="#000000">
<font color="#0000BB">&lt;?php phpinfo</font><font color="#007700">(); </font><font color="#0000BB">?&gt;</font>
</font>
</code>

O exemplo acima irá mostrar (no PHP 5):

<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?&gt;</span>
</span>
</code>

Nota: O parâmetro return tornou-se disponível no PHP 4.2.0. Antes disso é usado como o padrão, que é FALSE

Veja também highlight_file().

add a note add a note

User Contributed Notes 27 notes

up
14
stanislav dot eckert at vizson dot de
1 year ago
You can change the colors of the highlighting, like this:

<?php
ini_set
("highlight.comment", "#008000");
ini_set("highlight.default", "#000000");
ini_set("highlight.html", "#808080");
ini_set("highlight.keyword", "#0000BB; font-weight: bold");
ini_set("highlight.string", "#DD0000");
?>

Like you see in the example above, you can even add additional styles like bold text, since the values are set directly to the DOM attribute "style".

Also, this function highlights only text, if it begins with the prefix "<?php". But this function can highlight other similar formats too (not perfectly, but better than nothing), like HTML, XML, C++, JavaScript, etc. I use following function to highlight different file types and it works quite good:

<?php
function highlightText(
$text)
{
   
$text = trim($text);
   
$text = highlight_string("<?php " . $text, true);  // highlight_string() requires opening PHP tag or otherwise it will not colorize the text
   
$text = trim($text);
   
$text = preg_replace("|^\\<code\\>\\<span style\\=\"color\\: #[a-fA-F0-9]{0,6}\"\\>|", "", $text, 1);  // remove prefix
   
$text = preg_replace("|\\</code\\>\$|", "", $text, 1);  // remove suffix 1
   
$text = trim($text);  // remove line breaks
   
$text = preg_replace("|\\</span\\>\$|", "", $text, 1);  // remove suffix 2
   
$text = trim($text);  // remove line breaks
   
$text = preg_replace("|^(\\<span style\\=\"color\\: #[a-fA-F0-9]{0,6}\"\\>)(&lt;\\?php&nbsp;)(.*?)(\\</span\\>)|", "\$1\$3\$4", $text);  // remove custom added "<?php "

   
return $text;
}
?>

Note, that it will remove the <code> tag too, so you get the formatted text directly, which gives you more freedom to work with the result.

I personally suggest to combine both things to have a nice highlighting function for different file types with different highlight coloring sets:

<?php
function highlightText($text, $fileExt="")
{
    if (
$fileExt == "php")
    {
       
ini_set("highlight.comment", "#008000");
       
ini_set("highlight.default", "#000000");
       
ini_set("highlight.html", "#808080");
       
ini_set("highlight.keyword", "#0000BB; font-weight: bold");
       
ini_set("highlight.string", "#DD0000");
    }
    else if (
$fileExt == "html")
    {
       
ini_set("highlight.comment", "green");
       
ini_set("highlight.default", "#CC0000");
       
ini_set("highlight.html", "#000000");
       
ini_set("highlight.keyword", "black; font-weight: bold");
       
ini_set("highlight.string", "#0000FF");
    }
   
// ...

   
$text = trim($text);
   
$text = highlight_string("<?php " . $text, true);  // highlight_string() requires opening PHP tag or otherwise it will not colorize the text
   
$text = trim($text);
   
$text = preg_replace("|^\\<code\\>\\<span style\\=\"color\\: #[a-fA-F0-9]{0,6}\"\\>|", "", $text, 1);  // remove prefix
   
$text = preg_replace("|\\</code\\>\$|", "", $text, 1);  // remove suffix 1
   
$text = trim($text);  // remove line breaks
   
$text = preg_replace("|\\</span\\>\$|", "", $text, 1);  // remove suffix 2
   
$text = trim($text);  // remove line breaks
   
$text = preg_replace("|^(\\<span style\\=\"color\\: #[a-fA-F0-9]{0,6}\"\\>)(&lt;\\?php&nbsp;)(.*?)(\\</span\\>)|", "\$1\$3\$4", $text);  // remove custom added "<?php "

   
return $text;
}
?>
up
7
www.phella.net
10 years ago
When you quote highlighted PHP code in your website you need to escape quotes. If you quote a lot it may be annoyning. Here is tiny snippet how to make quoting tidy and clean. Write your code like this:

<?code()?>
  $string = 'Here I put my code';
<?code()?>

And somewhere else define the function:

<?
 
function code()
  {
    static
$on=false;
    if (!
$on) ob_start();
    else
    {
     
$buffer= "<?\n".ob_get_contents()."?>";
     
ob_end_clean();
     
highlight_string($buffer);
    }
   
$on=!$on;
  }
?>
up
5
Dmitry S
9 years ago
Alternative XML syntax highlighting.

<?php
function xml_highlight($s)
{       
   
$s = htmlspecialchars($s);
   
$s = preg_replace("#&lt;([/]*?)(.*)([\s]*?)&gt;#sU",
       
"<font color=\"#0000FF\">&lt;\\1\\2\\3&gt;</font>",$s);
   
$s = preg_replace("#&lt;([\?])(.*)([\?])&gt;#sU",
       
"<font color=\"#800000\">&lt;\\1\\2\\3&gt;</font>",$s);
   
$s = preg_replace("#&lt;([^\s\?/=])(.*)([\[\s/]|&gt;)#iU",
       
"&lt;<font color=\"#808000\">\\1\\2</font>\\3",$s);
   
$s = preg_replace("#&lt;([/])([^\s]*?)([\s\]]*?)&gt;#iU",
       
"&lt;\\1<font color=\"#808000\">\\2</font>\\3&gt;",$s);
   
$s = preg_replace("#([^\s]*?)\=(&quot;|')(.*)(&quot;|')#isU",
       
"<font color=\"#800080\">\\1</font>=<font color=\"#FF00FF\">\\2\\3\\4</font>",$s);
   
$s = preg_replace("#&lt;(.*)(\[)(.*)(\])&gt;#isU",
       
"&lt;\\1<font color=\"#800080\">\\2\\3\\4</font>&gt;",$s);
    return
nl2br($s);
}
?>
up
7
admin [at] develogix [dot] com
12 years ago
I've been working on a good replacement for the highlight_string() function; and here is what I've come up with so far:

<?
function get_sourcecode_string($str, $return = false, $counting = true, $first_line_num = '1', $font_color = '#666'){
   
$str = highlight_string($str, TRUE);
   
$replace = array(
       
'<font' => '<span',
       
'color="' => 'style="color: ',
       
'</font>' => '</span>',
       
'<code>' => '',
       
'</code>' => '',
       
'<span style="color: #FF8000">' =>
           
'<span style="color: '.$font_color.'">'
       
);
    foreach (
$replace as $html => $xhtml){
       
$str = str_replace($html, $xhtml, $str);
    }
   
// delete the first <span style="color:#000000;"> and the corresponding </span>
   
$str = substr($str, 30, -9);
               
   
$arr_html      = explode('<br />', $str);
   
$total_lines   = count($arr_html);   
   
$out           = '';
   
$line_counter  = 0;
   
$last_line_num = $first_line_num + $total_lines;
   
    foreach (
$arr_html as $line){
       
$line = str_replace(chr(13), '', $line);
       
$current_line = $first_line_num + $line_counter;
        if (
$counting){
           
$out .= '<span style="color:'.$font_color.'">'
                 
. str_repeat('&nbsp;', strlen($last_line_num) - strlen($current_line))
                  .
$current_line
                 
. ': </span>';
        }
       
$out .= $line
             
. '<br />'."\n";
       
$line_counter++;
    }
   
$out = '<code>'."\n".$out.'</code>."\n"';

    if (
$return){return $out;}
    else {echo
$out;}
}
?>

This function outputs valid XHTML 1.1 code by replacing font tags with span tags. You can also specify whether you want it to return or echo, output a line-count, the color of the line-count, and the starting line-count number.

Usage:
<?
// $str = string with php
// $return = true (return) / false (echo)
//    default of false
// $counting = true (count) / false (don't count)
//    default of true
// $start = starting count number
//    default of '1'
// $color = count color with preceding #
//    defalut of '#666'
get_sourcecode_string($str, $return,   $counting, $start, $color);
?>
up
5
manithu at fahr-zur-hoelle dot org
12 years ago
This function will return highlighted, xhtml 1.1 valid code (replaces <font> with <span> elements and color with style attributes):

<?php

function xhtml_highlight($str) {
   
$str = highlight_string($str, true);
   
//replace <code><font color=""></font></code>
   
$str = preg_replace('#<font color="([^\']*)">([^\']*)</font>#', '<span style="color: \\1">\\2</span>', $str);
   
//replace other <font> elements
   
return preg_replace('#<font color="([^\']*)">([^\']*)</font>#U', '<span style="color: \\1">\\2</span>', $str);
}

?>
up
3
Dobromir Velev
9 years ago
Here is an improved version of Dimitry's xml_highlight function.
I fixed a bug which replaced the first character of the tags name,
and added a line to replace the tabs and spaces with
non-breaking space symbols to keep the identation.

<?
function xml_highlight($s){
 
$s = preg_replace("|<([^/?])(.*)\s(.*)>|isU", "[1]<[2]\\1\\2[/2] [5]\\3[/5]>[/1]", $s);
 
$s = preg_replace("|</(.*)>|isU", "[1]</[2]\\1[/2]>[/1]", $s);
 
$s = preg_replace("|<\?(.*)\?>|isU","[3]<?\\1?>[/3]", $s);
 
$s = preg_replace("|\=\"(.*)\"|isU", "[6]=[/6][4]\"\\1\"[/4]",$s);
 
$s = htmlspecialchars($s);
 
$s = str_replace($text  $s = $s);
 
$s = htmlspecialchars($text
  $s = $s);
 
$s = = // remove suffix =iv class="n2</span>'an>$str);
}

<2s="comment">// remove suffix =iv class="n2</span>'
an>$str);
}

''
an>$str);
}

<4ing">''
keyworault">$str);
}

<5ing">''
keywspault">$str);
}

<6s="comment">// remove suffix =iv class="n2</span>'
an>$stras $html => // remove suffix =iv class="n2</span>n>$str= preg_replace("|\=\"(.*)\"|isU", $out.// remove suffix yword">.$out.// remove suffix yword">."[6]=[/6][4]\"\\1\"[/4]",$out.$str.$s);
 
$s ($s);
}
?>
up a>
5
6#77620" class="name"> 2 Dobromii8742r id="Vu83trong>
T8742reun working on a good replacement for the highligh did $stgssabr /expec If res> s fromabr /span cou cathe first character,spanIor" hrepIf my itl theittionmuch mofaulfficient. Tr /sldhe tniv sesameclass="strinspace symbols toass="str tabs and sspactiongena return o. Tr /snlyeclass="strinsgenmy span>
pan titttiongena rass="eywor'd return o./span>function ?>($str) {
   
$str = highlight_string($str, true);
   
//replace <code><font color=""><an class="default">highlight_string($text
ass="stord">=
$strkeass="stord">= $strkeeyword">= //replace other <font&g('#<font color="([^\']*)">([^\']*)</font>#U''<span style="color: \\1">\\2</span>'ss="keyword">, $font_color = ?>
up a>
7
6#50069" class="name"> 1 admin [11726hr id="Vu83trong>
11726hreuction will return highlighted, xhtml 1.1 valid co nlyebuof*must*nult of"><PHP'soope pan n ount,span wisealine unplaces <st<mode-cobuof <n14"he first can>
up a>
3
5750069" class="name"> 1 admin [iv824r id="Vu83trong>
He824reuan improved version of Dimitry's xml_highlight function.
I fixed a bug whan> &'s="km>admin http://nlte=d.netght-strien/ class="usernotes-voteu">te=d#70456"klalu834fodiowte=d#704569 yeaspan>function ('<br />', '<br />', '<br />', '<br />'(lace <code><gt;<lass="keyword">);
    foreach (
highlight_string(pan class="string">'<br />', $out($textass="stord">=
$out("[6]=[/6][4]\"\\1\"[/4]"<)="keyword">(
$out
('<br />'$line_counter++;
    }cult">highlight_string
(pan classss="comment">// remove suffix ult">$returnas highlight_string=>
  . $out .= highlight_string<."\n".    }g">"\n"."\n""\n"$out t;code><gt;<lass="keyword">);
    forep;   foreass=class="keyword">, $str
, $font_color
= $current_line
.=
highlight_string<
."\n"($text
ass="stord">= "\n""\n", $line);
   pan class="default">$str
, );
   
//rep)yword">."\n"   . .= highlight_string<
."\n", '#<font color="([^\']*)">([^\']*)</font>#U'<(up"\n"ault">strlen($textass="stord">= "\n""\n", $line);
   pan class="default">$str
, . clin=         keyword">);
   
//rep))yword">."\n"(.<, \'andaleamono\', \'monotype.com\', \'lucidaoasssone\', monoslass;"string">"\n"
. "\n"."\n"
73624ref="/manual/vote-note.php?id=83460&73624reunction.highlight-string&vote=down"73624"Vote up!" class="usernotes-voteu">up
up a>
3
5750069" class="name"> 1 admin [73624r id="Vu83trong>
73624reuction will return highlighted, xhtml 1.1 valid code (oan>
s="dea sesamebio)
up a>
3
#50069" class="name"> -3 admin [113249" id="Vu47trong>
9 years ago
113249" uction will return highlighted, xhtml 1.1 valid s="keyword">() {
&nbsdefault">fpan>('<br />') {
    sourcn=asing">'<br />'('<br />') {
    sourcn=asing">'<br />'(lace &lyword">) {
    sourcn=asing">'<br />'
('<br />') {
&nbsword">.$out('<br />') {
&nbsword">.$out(word">.$s(word">.$out('<br />') {
    ; &n_asuntg">'<br />') {
   ss="comment">// remove suffix ulce &lforeach ("keyword">(
(
(// remove suffix )lce &l>((<./yword">) {
&nbsclass="d'nspate\3\\nspatd\3\\=pan>$styword">.  &n_asuntg">'<br />'.
.<'on $stlace &lyword">) {
    ; &n_asuntg">'<br />'
(
'<br />') {
&nbsword">.<'on <\?(spa)?[^[:graph:]]=pan>$st=yword">) {
    asin_; &ns="comment">// remove suffix ))((<./yword">) {
&nbsclass="d'nspatd\3\\=pan>$styword">.&nbscla_replacng">'<br />') {
&nbsword">.<'on $out
(word">.<'nspapss="s3\\=pan>$str=an class="keyword">(word">.<'=pan>$st=yword">) {
   pan class="defaug">'<br />'
) {
    asin_; &ns="comment">// remove suffix =yword">) {
   
//re))yword">..<'on $stlace &lent)lce &lkeyword">((<./yword">) {
&nbsclass="d'nspatd\3\\=pan>$styword">.&nbsereu_replacng">'<br />') {
&nbsword">.<'(up$out
(word">.<'=pan>$st=yword">) {
   cla_replacng">'<br />'
) {
&nbsword">.<'on $out
(word">.<'nspapss="s3\\=pan>$str=an class="keyword">(word">.<'=pan>$st=yword">) {
   pan class="defaug">'<br />'
) {
&nbsclass="d'on $styword">. asin_; &ns="comment">// remove suffix =yword">) {
   
//re)))yword">..<'on $stlace &l}lce &llass="keyword">(<, \'andale;mono\', \';monotype."> \', \'lucida spssone\', mono($styword">. format460=asinn class="keyword">(<.word">..<'on $stlace &l}lce &le>
up a>
3
5#50069" class="name"> 0 admin [79869r id="Vu83trong>
79869reun working on a good replacement for the highligh or o a lo buildna betltr span> {}=- fromaclass="s ent for th. Itput aor o a lo r /kc class="sausIf genmy PHP
s="ds tooe starionmuch betltr!/span> admin http://www.telr /ya.com/art2/262/sernotes- a -syntax/"klalu834fodiows="dditcltan>n PHP 5.2.0./span>
647ext"f="/manual/vote-note.php?id=50069&647ext"unction.highlight-string&vote=down"647ex"Vote up!" class="usernotes-voteu">up
up a>
3
5#50069" class="name"> 0 admin [647ext id="Vu83trong>
9 years ago
647ext"uction will return highlighted, xhtml 1.1 valid code has $stbeeugmen s="t;spbuof thapp60"> anatpPHP tpe pan s="delospan n o> <
<$str
, $s
le/span><
<$str, $s
up a>
7
5#50069" class="name"> 0 admin [i3800r id="Vu83trong>//onfat gmail7214"> ¶
I3800reuction will return highlighted, xhtml 1.1 valid Oesdleavitt AT ucsc DOT edu's 000;"&gs insteadatab"piggusmalov> aep itler/div good programmher claassce. Justtinfcasea"piggusmalov> ion.ctu/div inf$n claoteu">tee" id="50069">
51762ref="/manual/vote-note.php?id=47214&51762reunction.highlight-string&vote=down" 1762"Vote up!" class="usernotes-voteu">up
up a>
7
5#50069" class="name"> 0 admin [i1762r id="Vu83trong>
I1762reuction will return highlighted, xhtml 1.1 valid W><ande (replaces colc xhss="defaucspaaspdol"><r /> or = csfunction ?>() {
    "<?php "
) {
    Lnbscult">highlight_string
(pan class="string">'<br />', $out
) {
    "<?php "
$return) {
    iult">highlight_string) {
   ss="comment">// remove suffix ulword">) {
    iult">highlight_string) {
   sp; }g">"\n") {
    Lnbsp;        ulword">) {
    iult">highlight_string
<++    = highlight_string<.$s. iult">highlight_string.$s) {
   ob_"default">$color
) {
   pan class="default">$str
, "<?php " $rlass="keyword">= '<br />') {
   ob_an>$color
) {
   ob_end_cleault">$current_line
$rlass="keyword">= $stsyword">) {
&nbsword">.="0r iell {="0r ,whi black black whi "iv cl,whi ;abackgrp; d-word">,#99ccff>,#99ccff>,whi ;"stri"\n"
.  &ng">"\n".,whi ;"stri"\n"$return=
$stsyword">) {
&nbsan class="Cring">'<br />'
.
"\n"($styword">. $st pan style="color:#000/div>
up a>
5
5#50069" class="name"> 0 admin [i9506r id="Vu83trong>
T9506reuction will return highlighted, xhtml 1.1 valid code ion.006tiv> (replaces've sernotes-her bbligh-ss="ish PHP
<$sts="keyword">;}
}
$s
function ?>($str, "<?php " (($textyword">;}
}
$out
($out
(//replace <code><font color=""><an class="matcltn class="keyword">(= $strlace <code><font color=""><an class="asstrinsn class="keyword">(= $s("|\=\"(.*)\"|isU",an class="matcllt">$out("|\=\"(.*)\"|isU"(//replace &l>
81257ref="/manual/vote-note.php?id=83460&1257reunction.highlight-string&vote=down" 1257"Vote up!" class="usernotes-voteu">up
up a>
3
4550069" class="name"> -1 admin [i1257r id="Vu83trong>
H1257reuction will return highlighted, xhtml 1.1 valid Well, Justt.006tiv> st;?ongeg I wr whicltsernotes-on.function ?&000;"> *************************************\n>
//rediv> "keyword">($st((($s((($s((($s("\n") {
    ass="stan>//rep>$out yword">) {
    clasan>//re-iv class="n) {
   sps="st n class="keyword">((//re  
 
p;   forespan>("\n"
) {
    posiss="an>//rep>$out yword">) {
    buffeann class="keyword">((class="den>'u caC00;"&g'\3\\ult">$s) {
    posiss="an>//re+syword">) {
   ss="comment">// remove suffix ulword">) {
    posiss="nn class="keyword">(<(
$current_line
) {
    clasan>//re-iv class="n) {
   sps="stan>//repcn>yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="den3\\unn class="keyword">() {
    posiss="an>//re++p>$out ">$out yword">) {
    buffeapan>$styspan class="keyword">(//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re]lace <code><gt;<gt;<default">$out ) {
    buffeann class="keyword">(<
.$s(//re-iv class="n) {
   sprd"iz6d n class="keyword">((
$stpan class="keyss="keyss="keyss="keylass="keyword">(//re  
 
p;   forespan>($str
, //rep>$out yword">) {
    buffeann class="keyword">((class="den>'tagName'\3\\ult">$s(((lace <code><gt;<yss="keykeyword">(   . foreyword">) {
    posiss="an>//re+syword">) {
   ss="comment">// remove suffix ulword">) {
    posiss="nn class="keyword">(<(
$current_line
) {
    clasan>//re-iv class="n) {
   sps="stan>//repcn>yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="den3\\unn class="keyword">() {
    posiss="an>//re++p>) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] =span class="keyword">(class="de unn class="keyword">(!keyword">(//rep>$out ss="keyss="keyss="keyss="keykeyword">(((//re $out ss="keyss="keyss="keyss="keykeyword">($styspan>.$s) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="de unn class="keyword">(keyword">(//rep>$out ss="keyss="keyss="keyss="keykeyword">(   . .= ((class="deult">$s(le we'repinft n n oan class="keyss="keyss="keyss="key
  ss="keyss="keykeyword">(
foreulword">) {
    posiss="nn class="keyword">(<(
$current_line
) {
    clasan>//re-iv class="n) {
   sps="stan>//repcn>yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="den3\\unn class="keyword">() {
    posiss="an>//re++p>) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="de=ult">$s.= ((//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re]lace <code><gt;<gt;<ss="keyss="keyss="keyss="key
  .= //respan>.$s$out yword">) {
    buffeann class="keyword">(<
.$s. atlasbut)$s..$s$out yword">) {
    atlasbut)nn class="keyword">((class="deult">$s(  ss="keyss="keyclass="default">$out
yword">) {
    inQuot)nn class="keyword">((lace <code><gt;<yss="key
  ss="keyss="keyclass="default">$out
yword">) {
    Quot)Typ)nn class="keyword">(($s
) {
    posiss="an>//re+syword">) {
   ss="comment">// remove suffix ulword">) {
    posiss="nn class="keyword">(<(
$current_line
) {
    clasan>//re-iv class="n) {
   sps="stan>//repcn>yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="den3\\unn class="keyword">(yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="de "yword">) {
&nbss
) {
    posiss="an>//re++p>) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] =span class="keyword">(class="d'"'>yword">) {
&nbss
<||>yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] =span class="keyword">(class="de'ult">$s$out yword">) {
    inQuot)nn class="keyword">((//re $out ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default">$out
yword">) {
    Quot)Typ)nn class="keyword">((//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] $out ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default">$out
yword">) {
    valspan>//reyspan>//re $out ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default">$out
yword">) {
&nbs000;"> aReadaUntil7nlasfquotass="nmarkun clasp;   fore">$out
ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default">$out
yword">) {
&nbsdefault">foreyword">) {
    posiss="an>//re+syword">) {
   ss="comment">// remove suffix ulword">) {
    posiss="nn class="keyword">(<(
$current_line
) {
    clasan>//re-iv class="n) {
   sps="stan>//repcn>yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span class="keyword">(class="den3\\unn class="keyword">(yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] !span clapan class="keyp;   Quot)Typ)yword">) {
&nbss
) {
    posiss="an>//re++p>$out yword">) {
    valspnn class="keyword">((
//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re]lace <code><gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<}">$out y clasp;   fore">$out
ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default">$out
yword">) {
    valspan>//reyspan>//re $out ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default) {
&nbs000;"> aNo Quotass="nmarksun clasp;   fore">$out
ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default">$out
yword">) {
    valspnn class="keyword">((
//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re]lace <t;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<}">$out ss="keyss="keyss="keyss="key
  ss="keyss="keyclass="default">$out
yce <t;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<default">$out
$out yword">) {
    buffeann class="keyword">(<
.$s. valspan>//reypan>.$s$out yce <t;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<gt;<default">$out $out $out ) {
    atlasbut)nn class="keyword">((class="deult">$s
) {
    buffeaan>//reyspan>.$s. atlasbut)$s..$s$out $out ) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] =span class="keyword">(class="den3\\unn class="keyword">(<){ />) {
    buffeapan>$styspan class="keyword">(//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re]ldefault">$out $out ) {
&nbs000;"> aInfcaseat nfauwnfaunoIatlasbut)sun clasp;   fore">$out
an>//reif yword">) {
    clasan>//re-iv class="n) {
   sps="stan>//re[yword">) {
    posiss="an>//re] =span class="keyword">(class="den3\\unn class="keyword">(!keyword">(//rep>$out ss="keyss="key) {
    buffeaan>//reyspan>.$s) {
    posiss="an>//re++lace <code><gt;<gt;<default">$out ) {
    clasan>//re-iv class="n) {
   sprd"iz6d n class="keyword">((
$stpan class="keyss="keyss="keyss="keylass="k--) {
    posiss="an>//re  
 
p;   forespan>($current_line
$out yword">) {
    clasan>//re-iv class="n) {
   sprd"iz6dan>//respan>.$s) {
    inTagnn class="keyword">((lace <code><gt;<yss="keyforeyword">) {
    popathe n class="keyword">(($s
) {
    popathen class="keyword">(<(
$current_line
) {
    clasan>//re-iv class="n) {
   sps="stan>//reppyword">) {
    popathen class="keyword">(<++p>$out ">$out
yword">) {
    clasChae n class="keyword">((//re-iv class="n) {
   sps="stan>//re[yword">) {
    popathen class="keyword">(<]lace <t;<gt;<gt;<gt;<gt;<gt;<yword">) {
    nlasChae n class="keyword">((//re-iv class="n) {
   sps="stan>//re[yword">) {
    popathen class="keyword">(<+yword">) {
   ss="comment">// remove suffix ]lace <t;<gt;<gt;<gt;<gt;<gt;<if yword">) {
    clasChae n class="keyword">(.$s) {
    nlasChae n class="keyword">(.$s) {
    popathe n class="keyword">((//re-iv class="n) {
   sprd"C00;"&gg">"\n"
) {
    popathen class="keyword">(<)sace <codeclass="k">$out
) {
    nlasChae n class="keyword">(.$s) {
&nbs000;"> aasrd"PHP )sespan>) {
&nbslass="key) {
    popathe n class="keyword">((//re-iv class="n) {
   sprd"Tault">$str
, (<)sace <codeclass="k">$out $out ss="keyss="keyss="keyss="keykeyword">(
//re-iv class="n) {
   sprd"iz6d n class="keyword">((
//re-iv class="n) {
   sps="stan>//re[yword">) {
    popathen class="keyword">(<]lace <t;<gt;<gt;<gt;<gt;<gt;<dan class="keyss="keyss="keyss="keydan class="keyss="keyss="keyss="keylass="keyword">(
//re-iv class="n) {
   sprd"iz6dan>//re  
 
>
<$curDocName n class="keyword">((//re[yword">) {
&nbsclass="d'doc=pan>$st]lace &lan class="keyword">((($current_line
) {
    curDocNamelt">$current_line
) {
&nbsword">.$s(((//re yword">) {
    docHandl)lt">$current_line
) {
&nbs$current_line) {
    curDocNamelt">$current_line
( yword">) {
    docHandl)lt">$current_line
((($st yword">) {
    docSt"C0s="stlt">$s
(((//re-iv class="n) {
   sprd"iz6lt">$current_line
(purpleldefault">$out redldefault">$out blspldefault">$out greenldefault">$out () {
&nbslass="keys="keyword">;}
}
$s. docum/splt">$s..$s
) {
&nbsclass="d'on =0 cell {=0\3\\=pan>$strulce &lforeach (e>
up a>
3
4#50069" class="name"> -1 admin [90378r id="Vu47trong>
90378reuction will return highlighted, xhtml 1.1 valid [EDIT BY danbritl AT spaaDOTpnet: The followpan id= sps=ains a anch-suppli6d vers:0px 1px 0px 1px; ace <code><font-family:Courier New, Courier; ace <code><float:lef-; ace <code><:0px 1px 0px 8px; ace <code><font-family:Courier New, Courier; ace <code><float:lef-; ace <code><margin:3px 0px 30px 0px; ace <code><} l(yword">) {
&nbsdefault">fpan>('<br />') {
    asing">'<br />'((($s('<br />') {
    asing">'<br />'((('<br />') {
&nbsword">.$out('<br />'(('<br />') {
    asinEg">'<br />'((class="deCrin:ln $s($s(<.$s) {
    asinEnn class="keyword">(
(($s) {
    asunt_; &nsn class="keyword">() {
&nbsclass="d'1=pan>$str l(<.$s(<(() {
    asunt_; &ns n class="keyword">(<-;font color=""><an class=ss="comment">// remove suffix ))"?pan class="keyword">(class="deu n class="keyword">(<:gt;<(keyword">(
(<+yword">) {
   ss="comment">// remove suffix )yword">.
.$s(<.$s((class="denspation will \"; &nclas\"\3\\ult">$s(('<br />') {
    asing">'<br />'
) {
   ss="comment">// remove suffix )l l((word">.$s
((// remove suffix yword">. r2lt">$s;}
}
$s
. rlt">$s..$out'<br />') {
&nbsclass="d'on $st=yword">) {
   ss="comment">// remove suffix )l l
53845" uction will return highlighted, xhtml 1.1 valid ht-ithu at fahr-zur-hoell
((('<br />') {
&nbsword">.$s(.$s(// remove suffix )lace &lan class="keyword">(
<$; &ns n class="keyword">((//reeyword">) {
&nbsclass="d'indexte=d=pan>$strulce &lace &le>
up a>
3
4#50069" class="name"> -1 admin [53351" id="Vu47trong>
9 years ago
53351" uction will return highlighted, xhtml 1.1 valid A neat fpan>((default">fpan>('<br />') {
    asing">'<br />') {
    val n class="keyword">(('<br />') {
    asing">'<br />'
(//re)sace <codeclass="kyword">) {
    val n class="keyword">(('<br />'
) {
&nbsword">.$out(.$s(//re)sace <codeclass="kyword">) {
    rows n class="keyword">(('<br />'
) {
&nbsword">.$s(//re)sace &lace <codeclass="kyword">) {
    row_num n class="keyword">() {
    i n class="keyword">((// remove suffix ulce &lace <codeclass="kforeacheyword">) {
    rows n class="keyword">(
('<br />') {
    i n class="keyword">(<(
$s) {
    i n class="keyword">((word">.$s. is="comment">// remove suffix ulce &lgt;<gt;<) {
    in class="keyword">() {
   ss="comment">// remove suffix ) >) {
    row_nums="comment">// remove suffix [] span class="keyword">(word">.) {
    in class="keyword">(.'<br />''<br />'.$s
) {
    in class="keyword">() {
   ss="comment">// remove suffix ) >) {
   is_intg">'<br />'
) {
    in class="keyword">() {
   2lt">$s
) {
    row_nums="comment">// remove suffix [] span class="keyword">(word">.) {
    in class="keyword">(.'<br />''<br />'.$s
) {
    row_nums="comment">// remove suffix [] span class="keyword">(word">.) {
    in class="keyword">(.'<br />''<br />'.$s
) {
    in class="keyword">(<++lace <code><}lce &lgt;<gt;<lass="keyword">(
) {
    _GETan>//re[yword">) {
&nbs
//re]g">'<br />'.$s.&nbsimplring">'<br />') {
    row_nums="comment">// remove suffix )yword">.
.$s
<000;"> a Loopathasugh ourpass=", show u ca sourcnsas u ca sourcn; a dpli&n numbhes too.ace &le>
<$; &ns n class="keyword">((((// remove suffix ) >) {
&nbsclass="d'on $strulce &lclass="defaults="keyword">) {
&nbsclass="d'on $strulce &lclass="defaults="keyword">) {
&nbsclass="d'on yword">) {
&nbss
<. (e>
<$; &n_num n class="keyword">(<+;font color=""><an class=ss="comment">// remove suffix ) .keyword">($strulce &lclass="defaults="keyword">) {
&nbsclass="d'on $strulce &lclass="defaults="keyword">) {
&nbsclass="d'on $strugt;<) {
   pan class="defaug">'<br />'
) {
    ; &ns="comment">// remove suffix )ulce &lclass="defaults="keyword">) {
&nbsclass="d'on
$strulce &lclass="defaults="keyword">) {
&nbsclass="d'on $strulce &l}lce &lace &le>
fpan>(() {
    ss="comment">// remove suffix )lce &l>) {
    s n class="keyword">(('<br />'
) {
&nbsword">.<"|on <[^/?](.*)\s(.*)="de|isUult">$out(word">.$out(// remove suffix )sace <codeclass="deass="yword">) {
    s n class="keyword">(('<br />') {
&nbsword">.<"|on $out(word">.$out(// remove suffix )sace <codeclass="deass="yword">) {
    s n class="keyword">(('<br />') {
&nbsword">.<"|on <\?(.*)\?="de|isUult">$out(word">.$out(// remove suffix )sace <codeclass="deass="yword">) {
    s n class="keyword">(('<br />') {
&nbsword">.<"|\=\"(.*)\"|isUult">$out(word">.$out(// remove suffix )sace <codeclass="deass="yword">) {
    s n class="keyword">((n class="keyword">() {
    ss="comment">// remove suffix )sace <codeclass="deass="yword">) {
    replacn n class="keyword">() {
   ss="comment">// remove suffix siv class="n) {
&nbsword">.<'0000FF=pan>$st="yword">) {
   2lt">$s
&nbsword">.<'808000=pan>$st="yword">) {
   3lt">$s
&nbsword">.<'800000=pan>$st="yword">) {
   4lt">$s
&nbsword">.<'FF00FF=pan>$st="yword">) {
   5lt">$s
&nbsword">.<'FF0000=pan>$st="yword">) {
   6s="comment">// remove suffix siv class="n) {
&nbsword">.<'0000FF=pan>$st)sace <codeclass="deass="foreacheyword">) {
    replacn n class="keyword">(
(// remove suffix siv class="n) {
&nbsan class= vs="comment">// remove suffix )lce <codeclass="deass=">) {
    s n class="keyword">(('<br />'
) {
&nbsword">.<"|\[ult">$s
. ks="comment">// remove suffix yword">..$s. ks="comment">// remove suffix yword">..$out(word">.$s. vs="comment">// remove suffix yword">..$out(// remove suffix )sace <codeclass="deass="}lce &lgt;<gt;<lass="keyword">(// remove suffix eyword">) {
    ss="comment">// remove suffix )sace &l}lce &le>
ass="vo >upte=d add a id=50nmall>9 yeass="vo50neass=">