Hiya fellow PHP coders!

I have a problem. I need a function to parse mIRC-colorcodes with PHP. Unfortunaly, I'm not capable to do this myself (or I'm thinking too advanced or something).

The code is built like this; chr(3) starts the color formating. After that sign, a series of numbers will come. Can be one or two digits (1-15). 0-9 can have an additional zero before it, like 00-09. Each of these number represents a color.

00 = White
01 = Black
02 = Dark Blue
03 = Dark Green
04 = Red
05 = Marron
06 = Purple
07 = Orange
08 = Yellow
09 = Green
10 = Teal
11 = Cyan
12 = Blue
13 = Magenta
14 = Dark Gray
15 = Gray

Now, to make it even worse, it's possible to use a background-color for the text. This is added with a coma. So, the syntax is "X4,8String" where X is really chr(3). Red (4) String with yellow (8) background.

The colorparsing can stop when another occurance of chr(3) commes up. Also, the colorparsing ends at the end of line.

Please help me on this issue.

//Simon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to