Return to Snippet

Revision: 40147
at January 27, 2011 00:44 by alesma


Initial Code
$text = substr($text,0,[a number]);
if ( substr($text,-1,1) != ' ' ) $text = substr($text, 0, strrpos($text, " "));

Initial URL

                                

Initial Description
This help you cutting text without cut the last word. Any feedback appreciated!

Initial Title
Shorten text without cutting words

Initial Tags
php, text

Initial Language
PHP