Regular expression recommended.
Another solution:
function bb_parse($str)
{
return str_replace(array('[b]', '[/b]'), array('<strong>', '</strong>'), $str);
}
This can lead to parsing due to incorrectly closing tags, resulting in the content being terminated by the HTML tag without closing.
source
share