Currently, the method I use to truncate strings is: echo substr($message, 0, 30).\"..\";
echo substr($message, 0, 30).\"..\";
How do I show the dots only in the case that the string has been tr
Just check the length of the original string to see if it needs to be truncated. If it is longer than 30, truncate the string and add the dots on the end:
if (strlen($message) > 30) { echo substr($message, 0, 30).".."; } else { echo $message; }