function cortarTexto($str,$num){ $str = substr($str,0,$num); return substr($str,0, -(strlen($str)-strrpos($str,' ')) ); }