Revision: 42835
Updated Code
at February 24, 2012 05:33 by mindshare
Updated Code
implode(' ',array_slice(explode(' ', $string),0,$length)); /* usage: $string = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; $length = 3; echo implode(' ',array_slice(explode(' ', $string),0,$length)); */
Revision: 42834
Updated Code
at March 11, 2011 04:31 by mindshare
Updated Code
implode(' ',array_slice(str_word_count($string,1),0,$length)); /* usage: $string = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; $length = 3; echo implode(' ',array_slice(str_word_count($string,1),0,$length)); */
Revision: 42833
Updated Code
at March 11, 2011 04:25 by mindshare
Updated Code
implode(' ',array_slice(str_word_count($string,1),0,$length)); /* usage: $string = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam varius quam nec arcu vehicula et posuere magna vulputate. Praesent imperdiet, urna sit amet consequat egestas, magna ipsum venenatis sem, nec gravida enim augue vitae nibh. Quisque commodo metus vitae erat volutpat at scelerisque ipsum interdum. Nulla ligula eros, gravida at commodo ut, tincidunt quis nibh. Sed consectetur, neque ut tempus mollis, augue lacus sagittis eros, sit amet dictum sapien dolor eget neque. Nulla at tortor ipsum. Suspendisse potenti. Aliquam erat volutpat. Morbi malesuada facilisis suscipit. Mauris eget tortor metus, sit amet sagittis mauris.'; $length = 10; echo implode(' ',array_slice(str_word_count($string,1),0,$length)); */
Revision: 42832
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 11, 2011 04:24 by mindshare
Initial Code
implode(' ',array_slice(str_word_count($string,1),0,$length)); // usage: $string = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam varius quam nec arcu vehicula et posuere magna vulputate. Praesent imperdiet, urna sit amet consequat egestas, magna ipsum venenatis sem, nec gravida enim augue vitae nibh. Quisque commodo metus vitae erat volutpat at scelerisque ipsum interdum. Nulla ligula eros, gravida at commodo ut, tincidunt quis nibh. Sed consectetur, neque ut tempus mollis, augue lacus sagittis eros, sit amet dictum sapien dolor eget neque. Nulla at tortor ipsum. Suspendisse potenti. Aliquam erat volutpat. Morbi malesuada facilisis suscipit. Mauris eget tortor metus, sit amet sagittis mauris.'; $length = 10; echo implode(' ',array_slice(str_word_count($string,1),0,$length));
Initial URL
Initial Description
Cut PHP strings at full word breaks.
Initial Title
Super-short PHP Word Limiter
Initial Tags
php
Initial Language
PHP