This php code is converted into HTML using 
     Colorizator v1.0 (c) 2001 by Alexander Yanuar Koentjara
                                  (lexzeus@hotmail.com) 

<? /* Program name : Colorizator v1.0 Author : Alexander Yanuar Koentjara lexzeus@hotmail.com Usage : php -q colorizator.php source.php output.htm Purpose : To make php code become a nice colorful HTML file !! */ set_time_limit(0); if (!trim($argv[2])) print "Need <param1> and <param2\n". "Usage : php -q colorizator.php source.php output.htm"; $CODE_BEGIN = "<"."?"; // sorry ... so it will not caught by Colorizator $CODE_END = "?".">"; // sorry ... so it will not caught by Colorizator $arr_RESERVED_WORD = array( "if", "while", "for", "return", "else"); $arr_DECLARATION_WORD = array( "class", "var", "function", "global", "GLOBAL"); $color_RESERVED_WORD = "RED"; $color_DECLARATION_WORD = "BLUE"; $color_COMMENT = "#707090"; $color_DEFAULT = "#3333aa"; $color_STRING = "#800000"; $color_VARIABLE = "GREEN"; $color_HTML = "BLACK"; $splitter = "|X*-(LexZ)"."-*X|"; $splitter2 = "|X*-(Kick)"."-*X|"; function generate_ereg($arr) { $x=""; for($i=0;$i<count($arr);$i++) $x.="|$arr[$i]"; return substr($x,1); } $RESERVED_WORD = generate_ereg($arr_RESERVED_WORD); $DECLARATION_WORD = generate_ereg($arr_DECLARATION_WORD); $file_from = trim($argv[1]); $file_to = trim($argv[2]); $f_arr = join("",file($file_from)); $fr = fopen($file_to,"w"); fputs($fr, "<HTML> <!-- This php code is converted into HTML using Colorizator v1.0 (c) 2001 by Alexander Yanuar Koentjara (lexzeus@hotmail.com) --> <BODY BGCOLOR=WHITE> <PRE>\n"); fputs($fr,"<FONT FACE='Courier New' size=2 color=$color_DEFAULT>"); $delimiter=array(0=>0, "//"=>array(2,"[\r\n]",$color_COMMENT), "\""=>array(1,"\"",$color_STRING), "'"=>array(1,"'",$color_STRING), "/*"=>array(2,"\*/",$color_COMMENT), "#"=>array(1,"[\r\n]",$color_COMMENT)); function x_parse($fr, $str) { GLOBAL $delimiter, $splitter, $splitter2, $color_VARIABLE, $RESERVED_WORD, $DECLARATION_WORD, $color_RESERVED_WORD, $color_DECLARATION_WORD; $flag = 0; $pos2 = -1; $all = ""; while($pos2<strlen($str)-1) { $pos2++; if ($flag) { $flag2=1; if (substr($str,$pos2-1,1)=="\\") $flag2=0; if (substr($str,$pos2-2,2)=="\\\\") $flag2=1; if (ereg($delimiter[$flag][1],substr($str,$pos2,$delimiter[$flag][0])) && $flag2) { $all.=htmlspecialchars(substr($str,$pos2,1)). "$splitter2</FONT>"; $flag=0; } else { $all.=htmlspecialchars(substr($str,$pos2,1)); } } else { reset($delimiter); while (list($key,$val)=each($delimiter)) { if ($key) { if (substr($str,$pos2,$val[0])==$key) { $all.="<FONT COLOR=$val[2]>$splitter". htmlspecialchars(substr($str,$pos2,$val[0])); $pos2+=($val[0]-1); $flag=$key; break; } } } if (!$flag) $all.=htmlspecialchars(substr($str,$pos2,1)); } } $all=eregi_replace("(\\\$[a-z0-9_]+)", "<FONT COLOR=$color_VARIABLE>\\1</FONT>", $all); $all=ereg_replace("([-()\r\n \t;=*+></\\.,])($RESERVED_WORD)([-()\r\n \t;=*+></\\.,])", "\\1<B><FONT COLOR=$color_RESERVED_WORD>\\2</FONT></B>\\3", $all); $all=ereg_replace("([-()\r\n \t;=*+></\\.,])($DECLARATION_WORD)([-()\r\n \t;=*+></\\.,])", "\\1<B><I><FONT COLOR=$color_DECLARATION_WORD>\\2</FONT></I></B>\\3", $all); $f_arr = explode($splitter,$all); $all = ""; if (count($f_arr)>1) for ($i=0;$i<count($f_arr);$i++) { $f_arr2 = explode($splitter2,$f_arr[$i]); if (count($f_arr2)>1) { $f_arr2[0] = eregi_replace( "(<[/]{0,1}FONT[^>]*>|<[/]{0,1}B>|<[/]{0,1}I>)", "",$f_arr2[0]); $all.=$f_arr2[0].$f_arr2[1]; } else $all.=$f_arr[$i]; } else $all = join("",$f_arr); fputs($fr,$all); } $pos1=0; $pos2=0; $f_arr = eregi_replace("<\?php([[:space:]])","<?\\1",$f_arr); while(1) { $posx = strpos(" $f_arr",$CODE_BEGIN); if (!$posx && strlen($f_arr)>0) $posx=strlen($f_arr)+1; if ($posx) { $posx--; fputs($fr, "<FONT COLOR=$color_HTML>". htmlspecialchars(substr($f_arr,0,$posx)). "</FONT>" ); } if (!strpos(" $f_arr",$CODE_BEGIN)) break; $pos1 = strpos("$f_arr","$CODE_BEGIN")+2; $pos2 = strpos($f_arr,"$CODE_END") - 1; if ($pos2<1) $pos2=strlen($f_arr)-1; fputs($fr,"&lt;?"); $str = substr($f_arr,$pos1,$pos2-$pos1+1); x_parse($fr,$str); fputs($fr,"?&gt;"); $f_arr = substr($f_arr,$pos2+3); } fputs($fr,"</FONT></PRE>\n"); fputs($fr,"</BODY>\n</HTML>\n"); fclose($fr); ?>