Posted By

andreiabohner on 12/27/09


php String limit truncate characters

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Truncate string length to n characters and use ...

 / Published in: PHP

  1. $max = 40;
  2. $desc = (strlen($desc)>$max)?(substr($desc, 0, $max).'...'):($desc);

Report this snippet  

You need to login to post a comment.