Re: Syntax highlighting of odd language
| From: | Aaron Gould | Date: | Fri, 05 Nov 2004 21:25:07 +0000 |
| Subject: | Re: Syntax highlighting of odd language | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201328@lists.php.net to get a copy of this message | ||
Bruno B B Magalhães wrote:
$code = 'function what() { do oddname; %oddsyntax }';
function highlight_code($code)
{
$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');
for($i = 0; $i <= count($oddsyntax)-1; $i++)
{
$highlighted_code = eregi_replace($oddsyntax[$i],'<spam class="highlighted">'.$oddsyntax[$i].'</spam>',$code);
}
return $code;
}
Hi Bruno...
I tried your sample, but it doesn't seem to work. I do however see what you're getting at.
Perhaps I need to experiment with the eregi_replace commands (or other regex commands) a bit.
Thanks,
--
Aaron Gould
Parts Canada - Web Developer