Revision: 22869
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 25, 2010 04:52 by jacinmontava
Initial Code
function acortar($cadena, $limite, $corte=" ", $pad="...") { if(strlen($cadena) <= $limite) return $cadena; if(false !== ($breakpoint = strpos($cadena, $corte, $limite))) { if($breakpoint < strlen($cadena) - 1) { $cadena = substr($cadena, 0, $breakpoint) . $pad; } } return $cadena; }
Initial URL
Initial Description
Con esta funcion podemos recortar una cadena de texto indicandole cuantos caracteres queremos que tenga y ademas no cortara la ultima palabra.
Initial Title
Acortar texto con palabras completas
Initial Tags
php, text
Initial Language
PHP