iPixel Posted August 22, 2007 Share Posted August 22, 2007 Ok i basically need to check for string length and if its more then lets say 20 characters cutoff the rest and add a ... at the end. $text = "This is my string which obviously is longer the 20 characters." if($strlen($text) >= 20) { // Cutoff anything past 20 characters. // So the results would look like ::: This is my string wh... } else { // Leave the string $text alone } Im not quite sure what function to use to get this done, i've checked the functions on http://us2.php.net/strings but unless im blind none of the descriptions say what im looking to do. Thanks in advance. ~iPixel Link to comment https://forums.phpfreaks.com/topic/66176-solved-string-cutoff/ Share on other sites More sharing options...
AndyB Posted August 22, 2007 Share Posted August 22, 2007 http://www.php.net/manual/en/function.substr.php Link to comment https://forums.phpfreaks.com/topic/66176-solved-string-cutoff/#findComment-330996 Share on other sites More sharing options...
thryb Posted August 22, 2007 Share Posted August 22, 2007 http://www.phpfreaks.com/forums/index.php/topic,156164.0.html Link to comment https://forums.phpfreaks.com/topic/66176-solved-string-cutoff/#findComment-331000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.