I need to trim a php string word by word until it is under a certain character limit.
ie I have a string "word1 word2 word3 word4 word5 word6"
I have a string limit of 20 characters...which falls in the middle of a word - i need to trim the string to return:
"word1 word2 word3" -
I have thought of a few probably overcomplcated ways of doing this.
Any help is greatly appreciated.
Start Free Trial