ZF-4734: Create a Zend_Filter_StringTruncate
Please create a Zend_Filter_StringTruncate class that will truncate a given string to a certain number of characters or words.
For example, I want to truncate the following:
The quick brown fox jumped over the lazy sleeping dog.
to 30 characters:
The quick brown fox jumped ove
or to 30 characters, but the closest whole word:
The quick brown fox jumped
or to 6 words (instead of characters):
The quick brown fox jumped over
This is a common filter that is needed and many developers end up implementing their own PHP code for this. It would be nice to have a standard way of truncating strings within ZF.