Posted By


pruntrut on 02/05/12

Tagged


Statistics


Viewed 144 times
Favorited by 0 user(s)

Limiter Nbr Lettre


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $chaine = $data['ContenuNews'];
  2.  
  3. // le nombre de lettres
  4. $max = 65;
  5.  
  6. if (strlen($chaine) >= $max) {
  7. $chaine = substr($chaine, 0, $max);
  8. $espace = strrpos($chaine, " ");
  9. $chaine = substr($chaine, 0, $espace)."...";
  10. }
  11.  
  12. echo stripslashes($chaine);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.