So you have some text with [random text] inside brackets and you want to get rid of it ?

I offer you two ways :

1. The simple one can be found everywhere on the net

$text = preg_replace(‘/\[(.*)\]/’, ”, $text);

2.Harder and funnier way. (my way)

function breaksRemove($str)
{
$array = explode(” “,$str);
foreach ($array as $key => $value) {
if($value[0] == ‘[' && $value[strlen($value)-1] == ‘]‘)
    {
        $array[$key] = ”;//here goes whatever you want
    }
else  {
        $array[$key] = $value;
    }
}
return implode(” “,$array);
}

//simple as that :)