Currently, the method I use to truncate strings is: echo substr($message, 0, 30)."..";
How do I show the dots only in the case that the string has been truncated?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just check the length to see if it’s more than 30 characters or not:
The typographic nitpick in me has this to add: the correct character to use is the ellipsis which comprises this character
…, three dots..., or its HTML entity….