Limit Displayed Characters From Your Text

This php tutorial will help you that how will apply limit displaying characters form you message and not cut out your word.


substr($message, start, length);

Example 1

This result shows 14 characters from your message

“Limit Display…”

This is not good. We want to display “Limit Displayed Characters…” Let’s solve this problem in example 2.

Example 2

1. Define how many characters you want to display.
2. Find what is the last character displaying.
3. If the last character displaying is not ” ” (space) then go to next character until we found it.
4. Display your message.

|—|——————— code ——————–|—|

Leave a Reply

Your email address will not be published. Required fields are marked *