Presa da php.net non trovo + il linkCodice PHP:
function truncate($string, $max = 200, $rep = '..') {
if (strlen($string) <= ($max + strlen($rep))) {
return $string;
}
$leave = $max - strlen ($rep);
return substr_replace($string, $rep, $leave);
}
![]()
![]()
Presa da php.net non trovo + il linkCodice PHP:
function truncate($string, $max = 200, $rep = '..') {
if (strlen($string) <= ($max + strlen($rep))) {
return $string;
}
$leave = $max - strlen ($rep);
return substr_replace($string, $rep, $leave);
}
![]()
![]()
Without faith, nothing is possible. With it, nothing is impossible
http://ilwebdifabio.it