My PHP script calls the Freebase API and outputs a string that can contain any number of open then closed brackets. Each set of open then closed brackets can also contain any number of open then closed brackets itself. For example;
$string = "random string blah (a) (b) blah blah (brackets (within) brackets) blah";
How can I use PHP and regex to manipulate the string resulting in an output that doesn't contain the contents of any brackets or the brackets themselves? For example;
$string = "random string blah blah blah blah";