Code: Select all
function bb_code($text)
{
$bbcode_to_from = array(
'/\[b\](.+)\[\/b\]/i' => '<b>$1</b>',
);
foreach ($bbcode_to_from AS $from => $to)
{
$text = preg_replace($from, $to, $text);
}
return $text;
}
$text = '[b]hel
lo[/b]';
Echo = bb_code($text);Code: Select all
'/\[b\]([.|/s+)\[\/b\]/i'