Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php limit string length

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

limit text length in 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;
    }
Comment

PREVIOUS NEXT
Code Example
Php :: today date to ago for the date in php 
Php :: laravel How to capture output in a file from php artisan test 
Php :: get date after 1 dayphp 
Php :: replace string in php 
Php :: update php version wamp windows 
Php :: Genrate Random number in php 
Php :: jquery code to trigger php function 
Php :: como destruir uma variavel de sessão 
Php :: foreign key cosntraint laravel 
Php :: insert value in session in laravel 
Php :: joomla get group id 
Php :: carbon compare same date 
Php :: laravel 8 websockets 
Php :: how to make core controller codeigniter 3 more than 1 
Php :: database seeder laravel 
Php :: disable display error 
Php :: laravel search multiple tables 
Php :: job with queue name in laravel 
Php :: php foreach ($_post as $key = $value) 
Php :: yajra laravel datatables rawcolumn 
Php :: laravel using username instead of email 
Php :: start php cli 
Php :: php strpos 
Php :: laravel add package without updating 
Php :: laravel post request page csrf disable 
Php :: configuration laravel dompdf 
Php :: post data to another page contact form 7 
Php :: dd php 
Php :: array_merge in php 
Php :: Databases supported by php 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =