substr($str, 0, 200);

or an (untested) ereg

ereg("(.{200}[^ ]*)", $str, $bits);

HTH
Martin

-----Original Message-----
From: Jason Williard [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 29 October 2003 1:53 PM
To: [EMAIL PROTECTED]
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to