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 Aug 12 by anonymous

Please log in or register to answer this question.

Related questions

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...