How to make string shorter by cut it on the last word?
like example, allowed symbols are 10, and echo only these words which fits in this limit.
$string = 'Hello Hello John Doe'
// Limit 10. Expected result:
$string = 'Hello'
// Limit 12. Expected result:
$string = 'Hello Hello'
...
All I can find in manual is cutting string by symbols, not by words. There are some custom functions to do so, but maybe there are php command for this?