This page is to show my suggestion of modification in the file parse/html.php for <phpcode> highlighting on PHP

version 5.0.0 or up. -- MiGi

p.s. I'm running the same code in both PHP 4.?(unknown) and 5.1.2 , and both go fine.


<?
function html_phpcode($text) 
{ 
...

  // Make it valid xhtml...
if (PHP_VERSION >= "5.0.0")
{
  // PHP 5.0:
  $search[0] = '<span style="color: '.ini_get('highlight.html').'">';
  $search[1] = '<span style="color: '.ini_get('highlight.default').'">';
  $search[2] = '<span style="color: '.ini_get('highlight.keyword').'">';
  $search[3] = '<span style="color: '.ini_get('highlight.string').'">';
  $search[4] = '<span style="color: '.ini_get('highlight.comment').'">';
  $search[5] = '</span>';
}else{
  $search[0] = '<font color="'.ini_get('highlight.html').'">';
  $search[1] = '<font color="'.ini_get('highlight.default').'">';
  $search[2] = '<font color="'.ini_get('highlight.keyword').'">';
  $search[3] = '<font color="'.ini_get('highlight.string').'">';
  $search[4] = '<font color="'.ini_get('highlight.comment').'">';
  $search[5] = '</font>';
}
  $search[6] = '';
  $search[7] = '<br />';
  $search[8] = '&nbsp;';
  $replace[0] = '<span class="html">';
  $replace[1] = '<span class="default">';
  $replace[2] = '<span class="keyword">';
  $replace[3] = '<span class="string">';
  $replace[4] = '<span class="comment">';
  $replace[5] = '</span>';
  $replace[6] = '';
  $replace[7] = "\n";
  $replace[8] = ' ';
...
?>