Posted By

pruntrut on 02/05/12


Tagged


Versions (?)

Limiter Nbr Lettre


 / Published in: PHP
 

  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  

You need to login to post a comment.