Say have have a bbcode list done like this:
[list]
[*]something
[*]something2
[/list]
What would be the best way in php to turn that into a html list?
Say have have a bbcode list done like this:
[list]
[*]something
[*]something2
[/list]
What would be the best way in php to turn that into a html list?
$string = '[list]
[*]something
[*]something2
[/list]';
$regex = array(
'/\[list\](.*?)\[\/list\]/is' => '<ul>$1</ul>',
'/\[\*\](.*?)(\n|\r\n?)/is' => '<li>$1</li>'
);
echo preg_replace(array_keys($regex), array_values($regex), $string);