On Thursday, February 5, 2004, at 02:35 AM, Brian Paulson wrote:
$string = substr($stringname,0,50);
echo $string;
http://www.php.net/substr
No, that's 50 *characters* -- he wanted 50 *words*. A quick and
reasonably accurate[1] solution would be this:
Daniel,
There's a few things you need t
On Wed, 2004-02-04 at 09:00, Daniel Perez Clavero wrote:
> To Extract the first 50 words, should I use str_word_count, and
> explode/implode or there´s another way, much simple.
>
> Any sample would be apreciated.
> Regards
Regular expressions should do the trick:
$extract = array();
preg_match('
$string = substr($stringname,0,50);
echo $string;
http://www.php.net/substr
That will just give the first 50 characters of the string.
You could just try one of the many suggestions on
http://www.php.net/manual/en/function.str-word-count.php
Scroll down to the user comments and there is
:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Extract of a Paragraph
Hi list,
I would like to show a extract (first 50 words of a text), in order to
construct something similar to articles view with read more link.
To Extract the first 50 words, should I use str_word_count, and
explode/implode or
Hi list,
I would like to show a extract (first 50 words of a text), in order to
construct something similar to articles view with read more link.
To Extract the first 50 words, should I use str_word_count, and
explode/implode or there´s another way, much simple.
Any sample would be apreciated.
R
5 matches
Mail list logo