Re: PHP Tokenize a String by its length



Mavenos wrote:
Hi Web Masters,

Just wondering wether you can help us to come up with some tokenize
script.

My problem is wanted to display a LONG content into a short para (by
giving minimum letter lenght)

I mean if I have a 2 page content - just I want to display only 4 lines
having 200 letters then follows the content with "....." at the end of
short pera.

Can anybody help in this regards,
Thanks in advance


How about

$maxLetters = 300;
$shortContent = substr($longContent,0,$maxLetters).
                (strlen($longContent) > $maxLetters ? "..." : "");


luph .