Someone posted above
However, the speed is slow and long.
Here is
Function UBB ($ Str ){
$ Color = array ('red', 'blue', 'green ');
$ STR = eregi_replace ('\ [url \] ([a-zA-Z0-9 @: % _.~ #-\? &] +) \ [\/URL \] ',' <a href = http: // \ 1> \ 1 </a> ', $ Str ); // URL
$ STR = eregi_replace ('\ [url = http: // ([a-zA-Z0-9 @: % _.~ #-\? &] +) \] (. +) \ [\/URL \] ',' <a href = \ 1 target = _ blank> \ 2 </a> ', $ Str );
$ STR = eregi_replace ('\ [url = ([a-zA-Z0-9 @: % _.~ #-\? &] +) \] (. +) \ [\/URL \] ',' <a href = http: // \ 1 target = _ blank> \ 2 </a> ', $ Str );
$ STR = eregi_replace ('\ [img \] ([a-zA-Z0-9 @: % _.~ #-\? &] +) \ [\/IMG \] ',' \ 1 </img> ', $ Str ); // img
$ STR = eregi_replace ('\ [H ([1-6]) \] (. +) \ [\/H [1-6] \] ','
$ STR = eregi_replace ('\ [email \] ([_ \. 0-9a-z-] + @ ([0-9a-z] [0-9a-z-] + \.) + [A-Z] {2, 3}) \ [\/Email \] ',' <a href = mailto: \ 1> \ 1 </a> ', $ Str); // email
$ STR = eregi_replace ('\ [email = ([_\. 0-9a-z-] + @ ([0-9a-z] [0-9a-z-] + \.) + [A-Z] {2, 3}) \] (. +) \ [\/Email \] ',' <a href = mailto: \ 1> \ 2 </a> ', $ Str );
$ STR = eregi_replace ('\ [B \] (. +) \ [\/B \] ',' <B> \ 1 </B> ', $ Str );
$ STR = eregi_replace ('\ [I \] (. +) \ [\/I \] ',' <I> \ 1 </I> ', $ Str );
$ STR = eregi_replace ('\ [size = (. +) \] (. +) \ [\/size \] ',' <font size = \ 1> \ 2 </font> ', $ Str );
$ STR = eregi_replace ('\ [color = (. +) \] (. +) \ [\/color \] ',' <font color = \ 1> \ 2 </font> ', $ Str );
$ STR = eregi_replace ('\ [sub \] (. +) \ [\/SUB \] ',' <sub> \ 1 </sup> ', $ Str); // Mount
$ STR = eregi_replace ('\ [sup \] (. +) \ [\/sup \] ',' <sup> \ 1 </sup> ', $ Str); // supermark
For ($ I = 0; $ I <= count ($ color); $ I ++) $ STR = eregi_replace ('\['. $ color [$ I]. '\] (. + )\[\/'. $ color [$ I]. '\]', '<font color = '. $ color [$ I]. '>\\ 1 </font>', $ Str );
$ STR = preg_replace ("/\ [quote \] (. + ?) \ [\/Quote \]/is "," <BLOCKQUOTE> <font size = '1' face = 'courier new'> quote: </font> <HR >\\ 1 <HR> </BLOCKQUOTE> ", $ Str );
$ STR = preg_replace ("/\ [Code \] (. + ?) \ [\/Code \]/is "," <BLOCKQUOTE> <font size = '1' face = 'times new Roman '> code: </font> <HR color = 'lightblue'> <I> \ 1 </I> <HR color = 'lightblue'> </BLOCKQUOTE> ", $ Str );
$ STR = preg_replace ("/\ [sig \] (. + ?) \ [\/Sig \]/is "," <Div style = 'text-align: Left; color: darkgreen; margin-left: 5% '> <br> ------------------------ <br> \ 1 <br> -------------------------- </div> ", $ Str );
Return $ STR;
}