$kac= strlen($text)-5; //<b /> $sondan = substr($kac,5); if ($sondan!="<b />"){ $text=$text."<b />"; }