function TrimString($sString,$iLen=125){
  $retstring=strtok($sString," ")." ";
  do {
    if(!$tmp=strtok(" ")." ") break;
    $retstring.=$tmp;
  } while(strlen($retstring)<$iLen);
  if(strlen($retstring)<strlen(trim($sString))) $retstring .="...";
  return $retstring;
} // end function

Jamie Saunders wrote:

> Hi,
>
> What I'd like to do is take a string (paragraph) of text consisting of say
> 500 words and display only the first 100 words.  Is there a function able to
> do this?
>
> Thanks.
>
> Jamie


-- 
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]

Reply via email to