= $tailleMax )
{
$chaine = substr($chaine,0,$tailleMax);
$positionDernierEspace = strrpos($chaine,' ');
$chaine = substr($chaine,0,$positionDernierEspace).'...';
}
return $chaine;
}
/** Exemple d'utilisation **/
$uneChaineTropLongue = 'Lorem Ipsum is simply dummy text of the printing and ';
$uneChaineTropLongue.= 'typesetting industry.';
echo raccourcirChaine($uneChaineTropLongue, 40);
?>
