“Limite o comprimento do texto em php” Respostas de código

comprimento da sequência de limite de php

if (strlen($str) > 10)
   $str = substr($str, 0, 7) . '...';
Indian Gooner

Limite o comprimento do texto em php

// limit text length in php and provide 'Read more' link
    function read_more($string)
    {
      // strip tags to avoid breaking any html
        $string = strip_tags($string);
        if (strlen($string) > 35) {

            // truncate string
            $stringCut = substr($string, 0, 35);
            $endPoint = strrpos($stringCut, ' ');

            //if the string doesn't contain any space then it will cut without word basis.
            $string = $endPoint? substr($stringCut, 0, $endPoint) : substr($stringCut, 0);
            $string .= '...';
        }
        return $string;
    }
Codelone

Respostas semelhantes a “Limite o comprimento do texto em php”

Perguntas semelhantes a “Limite o comprimento do texto em php”

Mais respostas relacionadas para “Limite o comprimento do texto em php” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código