Truncate string by words in php

0

A custom function to truncate string by words in php. A common scenario will be when you need to display just a short version (excerpt) of description from the long description.

This function come in very handy in those situations. All you have to do is to pass the main string and the word limit, you can also to pass an extra string that will be attached at the end of the truncated string.

Share.
 

About Author

Entrepreneur & Dreamer

I am a passionate Software Professional, love to learn and share my knowledge with others.

Software is the hardware of my life.

Leave A Reply

CommentLuv badge

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.