aboutsummaryrefslogtreecommitdiff
path: root/library/functions.php
blob: ee3a0d0286068f55a6ae4d3d109653a63799046d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
session_start();

function truncate($text, $chars = 25) {
    if (strlen($text) <= $chars) {
        return $text;
    }
    $text = $text." ";
    $text = substr($text,0,$chars);
    $text = substr($text,0,strrpos($text,' '));
    $text = $text."...";
    return $text;
}
?>