All pastes #607689 Raw Edit

Mine

public php v1 · immutable
·published 2007-07-07 20:48 UTC
rendered paste body
function bb2html($str){    $str = htmlspecialchars($search, ENT_NOQUOTES);    $find = array('#\[ *b *\](.+)\[ */b *\]#is',        '#\[ *i *\](.+)\[ */i *\]#is',        '#\[ *u *\](.+)\[ */u *\]#is',        '#\[ *s *\](.+)\[ */s *\]#is',        '#\[ *(colou?r) *= *#([a-f0-9]{3}|[a-f0-9]{6}) *\](.+)[ *\1 *\]#is',        '#\[ *quote *\](.+)\[ */quote *\]#is');    $replace = array('<b>\1</b>',        '<i>\1</i>',        '<u>\1</u>',        '<s>\1</s>',        '<span style="color: #\2">\3</span>',        '<table width="100%" bgcolor="lightgray"><tr><td bgcolor="white">\1</td></tr></table>');    $str = preg_replace($find, $replace, $str);    return $str;}