Well I have the following function to summarize a string in php.
function resumo($string,$chars) {
if (strlen($string) > $chars) {
while (substr($string, $chars, 1) <> ' ' && ($chars < strlen($string))) {
$chars++;
}
}
return substr($string, 0, $chars);
}
echo resumo("bla bla bla bla bla", 4);
Well the problem I'm having is the following. I would like to know the number of letters at most, and the function is returning more letters.
And whenever the sting is summed up I want to add (...) three points. If I enter a string that does not need to be summarized, it is not necessary to add all three points.