//было $text = mb_substr($text,0,mb_strlen($text,'utf-8')-1,'utf-8'); if(!preg_match('#\.$#',$text)) $text .= '.'; //стало if(!preg_match('#[!\?\.]$#',$text)) $text = mb_substr($text,0,mb_strlen($text,'utf-8')-1,'utf-8'); if(!preg_match('#[!\?\.]$#',$text)) $text .= '.';