Belgin Fish Belgin Fish - 27 days ago 20
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) . '...';