CODE :
// Paramètre -> $Chaine : Le texte à modifier ...
// $Max : Ajouter '...' après $Max caractères
// Exemple -> CutText('Voici ma chaine de caractère à modifier',10);
// Résultat -> 'Voici ma c'
function CutText($Chaine,$Max) {
$Chaine= htmlspecialchars($Chaine);
if (strlen($Chaine) > $Max) {
$Chaine= substr($Chaine, 0, $Max);
$Chaine.= " ...";
}
return $Chaine;
}
Marquer favoris
Bookmark
Email This
Hits: 717
Commentaires (0)

Ecrivez un commentaire





















