lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
PHP: simple blurber
A quick and dirty way to create a blurb for a text string:

$_blurb_length = 5;

if ( str_word_count($text) > $_blurb_length && preg_match('%(\w+\s){'.$_blurb_length.'}%i', $text, $_BLURB) )
{
$blurb = rtrim($_BLURB[0]) . '...';
}
else
{
$blurb = $text;
}