I suppose you could just use a regex and to replace everything between the and the empty string: preg_replace[]
$str = '[B]This is bold[/B] and This is [color=#FFCCCC]colored[/color]';
echo preg_replace('#\[[^\]]+\]#', '', $str);
The following is displayed:
This is bold and This is colored
Here the template I used matches:
- a
[:\[ - Everything that is not a symbol
]:[^\]]- One or more times:
[^\]]+
- and
]:\]
Please note that [they ]are of particular importance - this means that you need to avoid them when you want to be interpreted literally.