How to get a substring at words boundaries in PHP?
For example, for a string
$a = "ab cc dde ffg ff";, I would like to get its substring of length at most 7 from position 0 without breaking words. A simple
substring($a, 0, 7) will break the word
Mar 24, 2018 at 7:53 pm