Belgin Fish Belgin Fish - 1 year ago 118
PHP Question

Limit String Length

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

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