someting i've used.
At 03:57 PM 8/8/2001 +1100, Justin French wrote:
>Hi all,
>
>I'd like to split a text block at 25 words, as a teaser for the full
>article. Now I know how to split at a certain character, but i don't
>want a half word or anything, so I want (i guess) to hunt for the 25th
7;.', -2);
-> 'mysql.com'
This function is multi-byte safe.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Hope this helps!
Robert V. Zwink
DAID Development LLC
http://www.zwink.net/daid.php
-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Wednes
Thanks to all who replied, this solution by Chris was bar far the
easiest to implement.
Really appreciate it :)
Chris Lambert wrote:
> $teaser = explode(" ", $article, 26));
> array_pop($teaser);
> $teaser = implode(" ", $teaser);
Justin French
--
PHP General Mailing List (http://www.php.n
Hi,
Best way i guess would be traverse the whole string and check for space.
Have a counter var which keeps count of the space. At the 25th occurence do
something like this -
$text_a = substr($text, 1, $i);
i assume that $i is the increment var in the loop.
$text_b = substr($text, $i+1);
This
$teaser = explode(" ", $article, 26));
array_pop($teaser);
$teaser = implode(" ", $teaser);
/* Chris Lambert, CTO - [EMAIL PROTECTED]
WhiteCrown Networks - More Than White Hats
Web Application Security - www.whitecrown.net
*/
- Original Message -
From: Justin French <[EMAIL PROTECTED]>
5 matches
Mail list logo