if text equal to length then display else display only 100 characters code example Example: php trim string if longer than substr($str,0,50);