$str = length($str)>17 ? substr($str,0,17).'...' : $str; [download]
In reply to Re: truncating a line by dreadpiratepeter in thread truncating a line by Anonymous Monk