Belgin Fish Belgin Fish - 7 months ago 90
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
if (strlen($str) > 10)
   $str = substr($str, 0, 7) . '...';