Added PHP Truncate Function to functions.php

This commit is contained in:
johnny@pittpc.com
2020-09-25 17:16:02 -04:00
parent 07ae63f635
commit 6e5a65ecb1

View File

@@ -172,4 +172,15 @@ function get_device(){
}
}
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;
}
?>