Jump to content

[SOLVED] String cutoff...


iPixel

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.