RE: [PHP] Shortening a String
| From: | Pablo Gosse | Date: | Wed, 29 Oct 2003 03:17:57 +0000 |
| Subject: | RE: [PHP] Shortening a String | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-167963@lists.php.net to get a copy of this message | ||
On Tuesday, October 28, 2003 6:53 PM Jason Williard wrote:
> I would like to display part of the output of a query. In many cases,
> the string returned by this query exceeds 200 characters. Is there a
> way to cut it off after 200 characters? Even better, is there a way
to
> cut it off at the next space after 200 characters?
This should do what you want.
substr($str,0,strpos($str,' ',200));
Cheers,
Pablo