Corta los primeros n caracteres de un texto, pero busca el espacio para no cortar una palabra


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



Copy this code and paste it in your HTML
  1. if (strlen($texto) > 500) {
  2. $texto = substr($texto,0,strpos($texto," ",500))." ...";
  3. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.