RE: [PHP] Shortening a String
| From: | Jason Williard | Date: | Wed, 29 Oct 2003 04:01:47 +0000 |
| Subject: | RE: [PHP] Shortening a String | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167966@lists.php.net to get a copy of this message | ||
Thanks. That's exactly what I was looking for and is working perfectly.
- Jason
-----Original Message-----
From: Pablo Gosse [mailto:gossep@unbc.ca]
Sent: Tuesday, October 28, 2003 7:18 PM
To: Jason Williard; php-general@lists.php.net
Subject: RE: [PHP] Shortening a String
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php