{% else-1 %}
*

                        
<?php

function bbcode($text){

$bbcode = array(

'/\[i\](.+)\[\/i\]/isU' => '<em>$1</em>',

'/\[b\](.+)\[\/b\]/isU' => '<strong>$1</strong>',



'/\[sub\](.+)\[\/sub\]/isU' => '<sub>$1</sub>',

'/\[sup\](.+)\[\/sup\]/isU' => '<sup>$1</sup>',

'/\[del\](.+)\[\/del\]/isU' => '<del>$1</del>',

'/\[u\](.+)\[\/u\]/isU' => '<span style="text-decoration:underline;">$1</span>',

'/\[big\](.+)\[\/big\]/isU' => '<span style="font-size:large;">$1</span>',

'/\[small\](.+)\[\/small\]/isU' => '<span style="font-size:small;">$1</span>',

'/\[code\](.+)\[\/code\]/isU' => '<code>$1</code>',

'/\[red\](.+)\[\/red\]/isU' => '<span style="color:#ff0000;">$1</span>',

'/\[yellow\](.+)\[\/yellow\]/isU' => '<span style="color:#ffff22;">$1</span>',

'/\[green\](.+)\[\/green\]/isU' => '<span style="color:#00bb00;">$1</span>',

'/\[blue\](.+)\[\/blue\]/isU' => '<span style="color:#0000bb;">$1</span>',

'/\[white\](.+)\[\/white\]/isU' => '<span style="color:#ffffff;">$1</span>',

'/\[size=([0-9]+)\](.+)\[\/size\]/isU' => '<span style="font-size:$1px;">$2</span>',

'#\[color=(\#[0-9A-F]{3,6}|[a-z\-]+)\](.*)\[/color\]#isU' => '<span style="color: \\1">\\2</span>',

'#\[align=(left|right|center)\](.*)\[/align\]#isU' => '<p style="text-align: \\1">\\2</p>');

return preg_replace(array_keys($bbcode), array_values($bbcode), $text);

}



?>
0 59 0
Без комментариев...