PHP Beta mIRC Code Highlight

Beta mIRC Code Highlight

<?
echo "<BODY bgcolor=#444444>";
$data = file("mirc.txt");

$ops = "isin isincs iswm iswmcs isnum isletter isalnum isalpha islower isupper ison isop ishop isvoice isreg ischan isban isaop isavoice isignore isprotect isnotify";
$eq = "== === != < > >= <= // \\ &";
$opala = "on ctcp";

function dai($show,$sym,$col) {
  $show = str_replace($sym,"<FONT color=$col>$sym</FONT>", $show);
  return $show;
}
function daigo($shit,$show,$col) {
  $test = explode("=", $shit);
  $test = explode("(", $test[0]);
  $test = explode(")", $test[0]);
  $show = str_replace($test[0],"<FONT color=$col>$test[0]</FONT>", $show);
  return $show;
}
function ops($show,$ops,$len,$part,$col) {
  $fuck = explode(" ",$ops);
  $me = sizeof($fuck);
  for($q=0; $q<$len; $q++) {
    $var = $part[$q];
    for($b=0; $b<$me; $b++) {
      $var2 = $fuck[$b];
      if ($var == $var2) { $show = dai($show,"$var2","blue"); }
    }
  }
  return $show;
}
echo "<PRE><FONT color=white>";

foreach($data as $show) {
  $part = explode(" ",$show);
  $len = sizeof($part);

  for($i=0; $i<$len; $i++) {

    $ex = explode("(",$part[$i]);
    $ex = explode(")",$ex[1]);
    $ex = explode("!",$ex[0]);
    $rez = chop($ex[0]);

    if ($rez[0] == '$') { $show = daigo($ex[0],$show,"ff6666"); }
    if ($rez[0] == '%') { $show = daigo($ex[0],$show,"lightgreen"); }

    $ex = explode(" ",$part[$i]);
    $rez = chop($ex[0]);

    if ($rez[0] == '$') { $show = daigo($ex[0],$show,"ff6666"); }
    if ($rez[0] == '%') { $show = daigo($ex[0],$show,"lightgreen"); }
  }

  $gogo = explode(" ",$opala);
  $lens = sizeof($gogo);

  for($j=0; $j<$lens; $j++) {
    $plqs = explode(":",$show);
    $plqs2 = explode(" ",$plqs[0]);

    if ($gogo[$j] == $plqs2[0] && eregi(":",$show) && $plqs[1] != "") {
      $test = explode(":",$show);
      $show = dai($show,"$test[0]","teal");
      $show = dai($show,"$test[1]","silver");
    }
  }

  $show = ops($show,$ops,$len,$part,"gold");

  $show = dai($show,":#:","orange");
  $show = dai($show,"alias ","orange");
  $show = dai($show,"{","yellow");
  $show = dai($show,"}","yellow");
  $show = dai($show,")","yellow");
  $show = dai($show,"(","yellow");
  $show = dai($show,"if ","red");
  $show = dai($show,"|","cc66cc");


  echo "$show";
}
echo "</FONT></PRE>";
?>