Re: PHP Tokenize a String by its length
- From: Lüpher Cypher <lupher.cypher@xxxxxxxxxxx>
- Date: Sat, 31 Dec 2005 10:12:21 GMT
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 .
- References:
- PHP Tokenize a String by its length
- From: Mavenos
- PHP Tokenize a String by its length
- Prev by Date: Re: PHP Tokenize a String by its length
- Next by Date: Re: PHP Tokenize a String by its length
- Previous by thread: Re: PHP Tokenize a String by its length
- Next by thread: Message box
- Index(es):