Truncate string by words in php


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.


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.

1 Comment

  1. Really nice articles. Maybe it is an idea if possible to put a bit more demos so visitors get a better idea how things work-out if all is up and running ? I have to say I saw lot’s of demos already but images are telling more than words.

    Awesome site. Enjoy your weekend!

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.