Daniel,
Here is a rather inelegant way to do this. I am sure there is a better way and I would
love for someone to point it out to us.
This function simply pulls out the first N words using the space as a delimiter.
function firstN($string, $N) {
// remove all double and more spaces
$string = ereg_replace("[[:space:]][[:space:]]+", " ",$string);
// explode the string on spaces, slice off the amount of words you want and
then implode it back to a single string
$return = implode(" ", array_slice (explode(" ",$string, $N + 1), 0, $N));
// return it
return $return;
} //end firstN
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]