All pastes #729787 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-08 10:20 UTC
rendered paste body
function bbcode($message) {
%	$input = array(
        '#\[B\](.+?)\[\/B\]#is',
        '#\[i\](.+?)\[\/i\]#is',
        '#\[U\](.+?)\[\/U\]#is',
        '#\[img\](.+?)\[\/img\]#is',
        '#\[url=(.+?)\](.+?)\[\/url\]#is',
        '#\[color=(.+?)\](.+?)\[\/color\]#is',
    );
    $output = array(
        '<strong>$1</strong>',
        '<em>$1</em>',
        '<span style="border-bottom: 1px solid;">$1</span>',
        '<img src="$1">',
        '<a href="$1">$2</a>',
        '<font color="$1">$2</font>',
    );
    return preg_replace($input, $output, $message);
}