Removing Last Set of Brackets in String

listed in answer

Removing Last Set of Brackets in String
0 votes, 0.00 avg. rating (0% score)

ANSWER:

You can do this with a regular expression based search and replace:

$line = preg_replace(
    array('~(*ANYCRLF)^(.*)s+([^()]+)$~m', '~(*ANYCRLF)R~'), 
    array('$1',                                 ','), 
    $block
);

by hakre from http://stackoverflow.com/questions/10194195