strip_tags ile html etiketlerini temizleyip yapabilirsin.(
*)
function trim_word($text, $length, $startPoint=0, $allowedTags=""){
$text = html_entity_decode(htmlspecialchars_decode($text));
$text = strip_tags($text, $allowedTags);
return $text = substr($text, $startPoint, $length);
}
echo trim_word("<h2 class='zzzz'>abcasdsdasasdas</h2>","6");