Sounds like a job for preg_replace. I'd refer you to a tutorial instead of giving code, but they have kind of a steep learning curve. So here's an example.
$string = 'This is some [random] data. [some] should be removed.';
echo preg_replace('/\\[[^\\]]*\\]/', '', $string);
What this does is to search for square brackets in a string, and replaces them (along with anything between them) with an empty string (the next parameter).