How to trim a string with the Supplement?

Somewhere there is a function for cutting a string to a certain long, but if that was reduced, then added the string to the end. In short we need to trim a string up to 20 characters and add an ellipsis, if it was cropped.
July 2nd 19 at 18:22
2 answers
July 2nd 19 at 18:24
no one except you can not determine whether the trimmed string.
well add ellipsis at the end of the line is this child's question
and about the circumcision line — this list. the substring from 0 to 20
July 2nd 19 at 18:26

Find more questions by tags PHP