Limit String Length

后端 未结 10 1237
不思量自难忘°
不思量自难忘° 2020-12-01 03:56

I\'m looking for a way to limit a string in php and add on ... at the end if the string was too long.

10条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 04:51

    2nd argument is where to start string and 3rd argument how many characters you need to show

    $title = "This is for testing string for get limit of string This is for testing string for get limit of string This is for testing string for get limit of string This is for testing string for get limit of string";
        echo substr($title,0,50);
    

提交回复
热议问题