How to get a substring at words boundaries in PHP?

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 dde.

asked 4 days ago by anonymous

Please log in or register to answer this question.

Related questions

1 answer
1 answer
asked May 23 by dtivl (2,500 points)
1 answer
1 answer
asked May 23 by dtivl (2,500 points)
Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...