protected function closetag($str)
{
$str = ltrim($str);
$closetag = substr($str, 0, 1);
if ($closetag == '(') {
$closetag = ')';
}
if ($closetag == '[') {
$closetag = ']';
}
if ($closetag == '{') {
$closetag = '}';
}
if ($closetag == '<') {
$closetag = '>';
}
return $closetag;
}