<? $str = substr($str, 0, n); $str = $str."..."; ?>
<? function standart_func_php($str) { if(strlen($str)>=30) { $str = substr($str, 0, 30); $str = $str."..."; } return $str; } $str = "тут 100500 знаков"; $str = standart_func_php($str); echo $str; ?>