|
php shorten textThis is a small function that shortens a string.
// Shorten a text if nessecary
function shortenText($txt='', $len=0){
if(strlen($txt) > $len){
$txt = substr($txt, 0, $len);
$t = split("[\n\r\t ]+", $txt);
$t = array_slice($t, 0, -1);
$txt = join(' ', $t);
$txt .= '...';
}
return $txt;
}
|
Russian proverb
Ne budi likha, poka likho spit Don´t wake up trouble while trouble is sleeping |