View Full Version : Show the first 236 characters....
Link14716
05-18-2003, 11:09 PM
Well, say I have a variable of text, $text. This variable may have 400 characters or more. What I want to do is cut out the extra characters, leaving it with 236, and if the original variable ($text) is more than 236 characters, it should add "..." after it. Any help would be appreciated. Thanks.
filburt1
05-18-2003, 11:27 PM
If it's just a variable:
if (strlen($text) > 236)
{
$text = substr($text, 0, 236) . "...";
}
If it's directly in a query:
IF(LENGTH(field) > 236, CONCAT(SUBSTRING(text, 0, 236), "..."), field)
Link14716
05-19-2003, 12:52 AM
Thank you, filburt. That's just what I needed. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.