RE: [PHP] Shortening a String
| From: | Martin Towell | Date: | Wed, 29 Oct 2003 02:59:26 +0000 |
| Subject: | RE: [PHP] Shortening a String | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-167961@lists.php.net to get a copy of this message | ||
substr($str, 0, 200);
or an (untested) ereg
ereg("(.{200}[^ ]*)", $str, $bits);
HTH
Martin
-----Original Message-----
From: Jason Williard [mailto:jasonw@pacifier.com]
Sent: Wednesday, 29 October 2003 1:53 PM
To: php-general@lists.php.net
Subject: [PHP] Shortening a String
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?
Thank you for any assistance,
- Jason