Limit String Length

后端 未结 10 1235
不思量自难忘°
不思量自难忘° 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:43

    $res = explode("\n",wordwrap('12345678910', 8, "...\n",true))[0];
    
    // $res will be  : "12345678..."
    

提交回复
热议问题